home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / infoserv / gopher / mvs / old-versions / gopher.ggmvs.distrib.cntl.Z / gopher.ggmvs.distrib.cntl
Encoding:
Text File  |  1993-02-21  |  866.2 KB  |  10,952 lines

  1. //JOBNAME  JOB ACCOUNT,'NAME'                                                   
  2. //*------------------------------------------------------------------*/         
  3. //*                                                                  */         
  4. //* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5. //*                                                                  */         
  6. //* This software is provided on an "AS IS" basis.  All warranties,  */         
  7. //* including the implied warranties of merchantability and fitness, */         
  8. //* are expressly denied.                                            */         
  9. //*                                                                  */         
  10. //* Provided this copyright notice is included, this software may    */         
  11. //* be freely distributed and not offered for sale.                  */         
  12. //*                                                                  */         
  13. //* Changes or modifications may be made and used only by the maker  */         
  14. //* of same, and not further distributed.  Such modifications should */         
  15. //* be mailed to the author for consideration for addition to the    */         
  16. //* software and incorporation in subsequent releases.               */         
  17. //*                                                                  */         
  18. //*------------------------------------------------------------------*/         
  19. //*                                                                             
  20. //* MVS GOPHER client                                                           
  21. //*                                                                             
  22. //* Author:  Steve Bacher <seb1525@mvs.draper.com>                              
  23. //*                                                                             
  24. //* Date:  July, 1992                                                           
  25. //*                                                                             
  26. //*--------------------------------------------------------------------         
  27. //*                                                                             
  28. //* This job creates the GOPHER distribution libraries (PDS's).                 
  29. //*                                                                             
  30. //* Run this JCL to create the PDS's, after customizing to suit.                
  31. //* (Obviously, put in a good JOB statement first.)                             
  32. //* To customize the JCL, change the defaults on the //GGLOAD PROC              
  33. //* statement to your liking, particularly the PREFIX default.                  
  34. //* You might also want to change the final qualifiers of the PDS's             
  35. //* created - to do this, find the // EXEC GGLOAD statements and                
  36. //* change the value of the TO parameter.                                       
  37. //*                                                                             
  38. //* See the $$README file (of the CNTL PDS, first in this stream)               
  39. //* for the rest of the installation instructions.                              
  40. //*                                                                             
  41. //GGLOAD  PROC CLS='*',BS='6160',U='3380',V='',                                 
  42. //             TRK1='30',TRK2='10',DIR='35',RLSE='RLSE',                        
  43. //             PREFIX='GOPHER.INSTALL.'                                         
  44. //*                                                                             
  45. //IEBUPDTE EXEC PGM=IEBUPDTE,PARM=NEW                                           
  46. //SYSPRINT DD   SYSOUT=&CLS                                                     
  47. //SYSUT2   DD   DISP=(NEW,CATLG,DELETE),DSN=&PREFIX.&TO,                        
  48. //         DCB=(RECFM=FB,LRECL=80,BLKSIZE=&BS),                                 
  49. //         SPACE=(TRK,(&TRK1,&TRK2,&DIR),&RLSE),UNIT=&U,VOL=SER=&V              
  50. //*                                                                             
  51. //         PEND                                                                 
  52. //CNTL     EXEC GGLOAD,TRK1='4',TO='CNTL'                                       
  53. //SYSIN    DD DATA,DLM='?!'                                                     
  54. ./   ADD NAME=$$README,SSI=010C0017                                             
  55.                                                                                 
  56. ------------------------------------------------------------------------        
  57.                                                                                 
  58.  Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992                  
  59.                                                                                 
  60.  MVS Gopher Server originally by Shawn Hart (Univ. of Delaware).                
  61.                                                                                 
  62.  This software is provided on an "AS IS" basis.  All warranties,                
  63.  including the implied warranties of merchantability and fitness,               
  64.  are expressly denied.                                                          
  65.                                                                                 
  66.  Provided this copyright notice is included, this software may                  
  67.  be freely distributed and not offered for sale.                                
  68.                                                                                 
  69.  Changes or modifications may be made and used only by the maker                
  70.  of same, and not further distributed.  Such modifications should               
  71.  be mailed to the author for consideration for addition to the                  
  72.  software and incorporation in subsequent releases.                             
  73.                                                                                 
  74. ------------------------------------------------------------------------        
  75.                                                                                 
  76.  MVS Gopher Client                                                              
  77.                                                                                 
  78.  Author:          Steve Bacher <seb1525@mvs.draper.com>                         
  79.                                                                                 
  80.  MVS Gopher Server                                                              
  81.                                                                                 
  82.  Author:          Shawn Hart   <shawn.hart@mvs.udel.edu>                        
  83.  Enhancements:    Steve Bacher <seb1525@mvs.draper.com>                         
  84.  Customizations:  Lou Joseph   <CWMY5C@IRISHMVS.CC.ND.EDU>                      
  85.                                                                                 
  86. ------------------------------------------------------------------------        
  87.                                                                                 
  88.  Contents of PDS's belonging to Gopher distribution:                            
  89.                                                                                 
  90.  Member     PDS Type    Description                                             
  91.                                                                                 
  92.  $$README   CNTL        This file                                               
  93.  ACCESS     CNTL        Sample server access file                               
  94.  ALLOAD     CNTL        JCL to allocate GOPHER load library                     
  95.  COMPILEC   CNTL        JCL to compile and link C source for client             
  96.  COMPILES   CNTL        JCL to compile and link C source for server             
  97.  GOPHERD    CNTL        JCL to run the GOPHER server in batch (No TSO)          
  98.  GOPHERT    CNTL        JCL to run the GOPHER server in batch (w. TSO)          
  99.  HELP       CNTL        TSO Help for Gopher client (with XPROC support)         
  100.  HELQ       CNTL        TSO Help for Gopher client (without XPROC)              
  101.  INSTALLC   CNTL        How to install the GOPHER MVS client                    
  102.  INSTALLS   CNTL        How to install the GOPHER MVS server                    
  103.  MENU       CNTL        Initial Gopher server menu                              
  104.  GOPHER     CLIST       Exec by which users invoke the Gopher client            
  105.  NNMFIUCV   CLIST       Exec to check for multiple socket applications          
  106.  GGM...     PANEL       ISPF regular panels                                     
  107.  GG...      H           C headers for compilation                               
  108.  GG...      C           C source for compilation                                
  109.  ABOUT...   ABOUT       "About This Gopher" text                                
  110.                                                                                 
  111. --------------------------------------------------------------------            
  112.                                                                                 
  113. Where to Go from Here:                                                          
  114.                                                                                 
  115.  To install the GOPHER MVS client, read member INSTALLC.                        
  116.                                                                                 
  117.  To install the GOPHER MVS server, read member INSTALLS.                        
  118.                                                                                 
  119. Note:                                                                           
  120.                                                                                 
  121.  You may install only the client, only the server, or both the                  
  122.  client and the server.  It is purely up to what your needs are.                
  123.                                                                                 
  124. --------------------------------------------------------------------            
  125.                                                                                 
  126. Changes:                                                                        
  127.                                                                                 
  128.  10/19/92 - Improvements in initial startup and GOPHERRC customization          
  129.  12/07/92 - Customizations to support SNS/TCPAccess                             
  130.                                                                                 
  131. --------------------------------------------------------------------            
  132.                                                                                 
  133.  Questions?  Comments?  Suggestions?  Gripes?  Please email to...               
  134.                                                                                 
  135.  Steve Bacher      <seb@draper.com> or <seb1525@mvs.draper.com>                 
  136.                                                                                 
  137. ./   ADD NAME=ACCESS,SSI=01020059                                               
  138. !                                                                               
  139. ! Format of entries:                                                            
  140. !                                                                               
  141. ! filename (fully qualified, all uppercase, no quotes)                          
  142. ! can be "DD:DDNAME" or "EXEC:EXECNAME"                                         
  143. !                                                                               
  144. ! followed by names of hosts which are authorized to access the data.           
  145. ! If no host name list is present, all hosts are authorized                     
  146. !                                                                               
  147. ! You may specify the same file name more than once, if you need                
  148. ! more lines to put host names on.                                              
  149. !                                                                               
  150. ! Individual PDS members must be specified separately.  A PDS without           
  151. ! a member name establishes access only to the PDS directory.                   
  152. !                                                                               
  153. ! Note that the default directory MUST be in this table.                        
  154. !                                                                               
  155. ! Also note that in the case of EXECs, the EXEC must live in the                
  156. ! library allocated to GGEXEC in the Gopher server JCL.                         
  157. !                                                                               
  158. ! *** ANY DATA SET REFERENCED BY ANY EXEC IN THAT LIBRARY IS FULLY              
  159. ! *** ACCESSIBLE TO GOPHER REGARDLESS OF THIS TABLE!  USE THIS TABLE            
  160. ! *** TO GOVERN CONTROL TO THE EXEC ITSELF!!!                                   
  161.                                                                                 
  162. !                                                                               
  163. ! below is default directory spec, which MUST be in this table                  
  164. !                                                                               
  165. DD:GGGOPHER                                                                     
  166.                                                                                 
  167. !                                                                               
  168. ! Use the following for "About This Gopher".                                    
  169. ! (Change the PDS name to match your installation.)                             
  170. ! Free free to specify the name of your MVS client host(s)                      
  171. ! for information pertinent to MVS only.  mvs1 and mvs2 are examples.           
  172. !                                                                               
  173. DD:GGABOUT                                                                      
  174. GOPHER.ABOUT(ABOUT)                                                             
  175. GOPHER.ABOUT(ABOUTC)                              mvs1 mvs2                     
  176. GOPHER.ABOUT(ABOUTCD)                             mvs1 mvs2                     
  177. GOPHER.ABOUT(ABOUTCF)                             mvs1 mvs2                     
  178. GOPHER.ABOUT(ABOUTCO)                             mvs1 mvs2                     
  179. GOPHER.ABOUT(ABOUTCQ)                             mvs1 mvs2                     
  180. GOPHER.ABOUT(ABOUTCS)                             mvs1 mvs2                     
  181. GOPHER.ABOUT(ABOUTCSC)                            mvs1 mvs2                     
  182. GOPHER.ABOUT(ABOUTCSL)                            mvs1 mvs2                     
  183. GOPHER.ABOUT(ABOUTCSM)                            mvs1 mvs2                     
  184. GOPHER.ABOUT(ABOUTCSR)                            mvs1 mvs2                     
  185. GOPHER.ABOUT(ABOUTCSW)                            mvs1 mvs2                     
  186. GOPHER.ABOUT(ABOUTCSX)                            mvs1 mvs2                     
  187. GOPHER.ABOUT(ABOUTCX)                             mvs1 mvs2                     
  188. GOPHER.ABOUT(ABOUTS)                              mvs1 mvs2                     
  189. GOPHER.ABOUT(ABOUTSA)                             mvs1 mvs2                     
  190. GOPHER.ABOUT(ABOUTW)                                                            
  191. GOPHER.ABOUT(FAQ)                                                               
  192.                                                                                 
  193. !                                                                               
  194. ! Here's how to do REXX execs.  Note - no arguments, only exec names            
  195. !                                                                               
  196. EXEC:CHECKLST                     client1 client2 mvs                           
  197. EXEC:WAISDIR                                                                    
  198. EXEC:WAISLIST                                                                   
  199. EXEC:WAISSRCH                                                                   
  200.                                                                                 
  201. ANY.PUBLIC.SEQ.DS                                                               
  202. ANY.SEMI.PUBLIC.SEQ.DS            goodclient1 goodclient2                       
  203. ANY.SEMI.PUBLIC.SEQ.DS            goodclient3 goodclient4                       
  204.                                                                                 
  205. ! PDS without member name provides access to directory only                     
  206. ! All member names must be explicitly listed to be accessible.                  
  207.                                                                                 
  208. ANY.PUBLIC.PDS                                                                  
  209. ANY.PUBLIC.PDS(MEMBER1)                                                         
  210. ANY.PUBLIC.PDS(MEMBER2)                                                         
  211. ANY.PUBLIC.PDS(MEMBER3)                                                         
  212. ANY.PUBLIC.PDS(MEMBER4)                                                         
  213.                                                                                 
  214.                                                                                 
  215. ANY.SEMI.PUBLIC.PDS               goodclient1 goodclient2                       
  216. ANY.SEMI.PUBLIC.PDS               goodclient3 goodclient4                       
  217. ANY.SEMI.PUBLIC.PDS(MEMBER1)      goodclient1                                   
  218. ANY.SEMI.PUBLIC.PDS(MEMBER2)      goodclient2                                   
  219. ANY.SEMI.PUBLIC.PDS(MEMBER3)      goodclient3                                   
  220. ANY.SEMI.PUBLIC.PDS(MEMBER4)      goodclient4                                   
  221.                                                                                 
  222. ./   ADD NAME=ALLOAD,SSI=01010051                                               
  223. //JOBNAME  JOB ACCOUNT,'NAME'                                                   
  224. //*                                                                  */         
  225. //* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  226. //*                                                                  */         
  227. //* This software is provided on an "AS IS" basis.  All warranties,  */         
  228. //* including the implied warranties of merchantability and fitness, */         
  229. //* are expressly denied.                                            */         
  230. //*                                                                  */         
  231. //* Provided this copyright notice is included, this software may    */         
  232. //* be freely distributed and not offered for sale.                  */         
  233. //*                                                                  */         
  234. //* Changes or modifications may be made and used only by the maker  */         
  235. //* of same, and not further distributed.  Such modifications should */         
  236. //* be mailed to the author for consideration for addition to the    */         
  237. //* software and incorporation in subsequent releases.               */         
  238. //*                                                                  */         
  239. //*                                                                             
  240. //* Allocate GOPHER load library before install                                 
  241. //*                                                                             
  242. //GGALLOC PROC BS='6233',U='3380',V='',                                         
  243. //             PRI='100',SEC='100',DIR='35'                                     
  244. //*                                                                             
  245. //IEFBR14  EXEC PGM=IEFBR14                                                     
  246. //ALLOCDD  DD   DISP=(NEW,CATLG,DELETE),DSN=&LIB,                               
  247. //         DCB=(RECFM=U,BLKSIZE=&BS),                                           
  248. //         SPACE=(&BS,(&PRI,&SEC,&DIR)),UNIT=&U,VOL=SER=&V                      
  249. //*                                                                             
  250. //         PEND                                                                 
  251. //*                                                                             
  252. //* The following step allocates the load library from which the                
  253. //* executable program will be run.  If you intend to place the                 
  254. //* executable into an existing library, you can skip this step.                
  255. //* Otherwise, the name must match the name used on the LOADLIB                 
  256. //* parameter of the GGLINK procedure in the COMPILE JCL.                       
  257. //*                                                                             
  258. //* If you want separate libraries for the client and the server,               
  259. //* just dup this step and give 'em different lib names.                        
  260. //*                                                                             
  261. //ALLOC1   EXEC GGALLOC,PRI=50,SEC=50,DIR=35,                                   
  262. //         LIB='GOPHER.LOAD'                                                    
  263. //*                                                                             
  264. ./   ADD NAME=COMPILEC                                                          
  265. //JOBNAME  JOB ACCOUNT,'NAME'                                                   
  266. //*                                                                  */         
  267. //* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  268. //*                                                                  */         
  269. //* This software is provided on an "AS IS" basis.  All warranties,  */         
  270. //* including the implied warranties of merchantability and fitness, */         
  271. //* are expressly denied.                                            */         
  272. //*                                                                  */         
  273. //* Provided this copyright notice is included, this software may    */         
  274. //* be freely distributed and not offered for sale.                  */         
  275. //*                                                                  */         
  276. //* Changes or modifications may be made and used only by the maker  */         
  277. //* of same, and not further distributed.  Such modifications should */         
  278. //* be mailed to the author for consideration for addition to the    */         
  279. //* software and incorporation in subsequent releases.               */         
  280. //*                                                                  */         
  281. //*********************************************************************         
  282. //*                                                                             
  283. //* Compile some or all GOPHER C/370 sources to make the SYSLIN input           
  284. //* to the linkedit of the executable Gopher load module(s).                    
  285. //*                                                                             
  286. //GGCC   PROC MEMBER=,                                                          
  287. //            SRCLIB='GOPHER.C',                 GOPHER C source PDS            
  288. //            HDRLIB='GOPHER.H',                 GOPHER C headers PDS           
  289. //            COMMHDR='TCPIP.COMMMAC',           C/370 TCP/IP headers           
  290. //            C370HDR='SYS1.EDCHDRS',            C/370 standard headers         
  291. //            SYSMSGS='SYS1.EDCMSGS',            C/370 messages file            
  292. //            SYSMSGM='EDCMSGE',                 C/370 message member           
  293. //            VIOUNIT=VIO,                       Temporary disk unit            
  294. //            OUTCLAS='*',                          SYSOUT class                
  295. //            CPARMS='SOURCE EXPMAC NOAGGR NOXREF', Compile parameters          
  296. //            TEST=TEST                             TEST or NOTEST              
  297. //*                                                                             
  298. //CCOMP     EXEC PGM=EDCCOMP,PARM='MARGINS(1,72) &TEST &CPARMS'                 
  299. //SYSMSGS   DD DISP=SHR,DSN=&SYSMSGS(&SYSMSGM)                                  
  300. //SYSIN     DD DISP=SHR,DSN=&SRCLIB(&MEMBER)                                    
  301. //SYSLIB    DD DISP=SHR,DSN=&COMMHDR                                            
  302. //          DD DISP=SHR,DSN=&C370HDR                                            
  303. //USERLIB   DD DISP=SHR,DSN=&HDRLIB                                             
  304. //SYSLIN    DD DSN=&&LOADSET,UNIT=&VIOUNIT,DISP=(MOD,PASS),                     
  305. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  306. //SYSPRINT  DD SYSOUT=&OUTCLAS                                                  
  307. //SYSCPRT   DD SYSOUT=&OUTCLAS                                                  
  308. //SYSUT1    DD DSN=&&SYSUT1,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  309. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  310. //SYSUT4    DD DSN=&&SYSUT4,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  311. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  312. //SYSUT6    DD DSN=&&SYSUT6,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  313. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  314. //SYSUT7    DD DSN=&&SYSUT7,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  315. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  316. //SYSUT8    DD DSN=&&SYSUT8,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  317. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  318. //SYSUT9    DD DSN=&&SYSUT9,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  319. //   SPACE=(32000,(30,30)),DCB=(RECFM=VB,LRECL=137,BLKSIZE=882)                 
  320. //SYSUT10   DD SYSOUT=&OUTCLAS                                                  
  321. //*                                                                             
  322. //         PEND                                                                 
  323. //*                                                                             
  324. //*********************************************************************         
  325. //*                                                                             
  326. //* Linkedit an executable Gopher load module.                                  
  327. //*                                                                             
  328. //* Note: If C/370 V1R2 or higher, and you have therefore accepted              
  329. //*       the "#define FETCH" in the GG header, you may delete                  
  330. //*       the line that includes the ISPLINK library.                           
  331. //*                                                                             
  332. //* Note: If TCP/IP V2 or higher, remove the PASCAL link libraries              
  333. //*       from the JCL and the AMPZMVSB card from the control deck.             
  334. //*                                                                             
  335. //GGLINK PROC LOADLIB='GOPHER.LOAD',             Executable load library        
  336. //            PLIBASE='SYS1.PLIBASE',            PL/1   link library            
  337. //            EDCBASE='SYS1.SEDCBASE',           C/370  link library            
  338. //            IBMBASE='SYS1.SIBMBASE',           PL/1+C common library          
  339. //            COMMTXT='TCPIP.COMMTXT',           TCP/IP link library            
  340. //            PASRUN3='SYS1.PAS.SAMPRUN3',       PASCAL link library            
  341. //            PASRUN1='SYS1.PAS.SAMPRUN1',       PASCAL link library            
  342. //            PASMSG1='SYS1.PAS.SAMPMSG1',       PASCAL link library            
  343. //            ISPLINK='ISP.V3R2M0.ISPLLIB',      ISPLINK link library           
  344. //            VIOUNIT=VIO,                       Temporary disk unit            
  345. //            OUTCLAS='*',                          SYSOUT class                
  346. //            LPARMS='LIST,LET,MAP',                Linkedit parameters         
  347. //            TEST=TEST                             TEST or NOTEST              
  348. //*                                                                             
  349. //LKED      EXEC PGM=IEWL,PARM='AMODE(31),&TEST,&LPARMS'                        
  350. //SYSPRINT  DD SYSOUT=&OUTCLAS                                                  
  351. //SYSLIB    DD DISP=SHR,DSN=&PLIBASE                                            
  352. //          DD DISP=SHR,DSN=&EDCBASE                                            
  353. //          DD DISP=SHR,DSN=&IBMBASE                                            
  354. //          DD DISP=SHR,DSN=&COMMTXT                                            
  355. //          DD DISP=SHR,DSN=&PASRUN3  if TCP/IP V1 only                         
  356. //          DD DISP=SHR,DSN=&PASRUN1  if TCP/IP V1 only                         
  357. //          DD DISP=SHR,DSN=&PASMSG1  if TCP/IP V1 only                         
  358. //          DD DISP=SHR,DSN=&ISPLINK  if C/370 V1R1 with #undef FETCH           
  359. //SYSLMOD   DD DISP=SHR,DSN=&LOADLIB                                            
  360. //SYSUT1    DD DSN=&&SYSUT1,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  361. //          SPACE=(32000,(30,30))                                               
  362. //*                                                                             
  363. //         PEND                                                                 
  364. //*                                                                             
  365. //GGCLIENT EXEC GGCC,MEMBER=GGCLIENT                                            
  366. //GGMALLOC EXEC GGCC,MEMBER=GGMALLOC                                            
  367. //GGMBRIFC EXEC GGCC,MEMBER=GGMBRIFC                                            
  368. //GGMBRIFR EXEC GGCC,MEMBER=GGMBRIFR                                            
  369. //GGMCLRTX EXEC GGCC,MEMBER=GGMCLRTX                                            
  370. //GGMCONN  EXEC GGCC,MEMBER=GGMCONN                                             
  371. //GGMCSO   EXEC GGCC,MEMBER=GGMCSO                                              
  372. //GGMDFAIL EXEC GGCC,MEMBER=GGMDFAIL                                            
  373. //GGMDIR   EXEC GGCC,MEMBER=GGMDIR                                              
  374. //GGMDISC  EXEC GGCC,MEMBER=GGMDISC                                             
  375. //GGMDISPL EXEC GGCC,MEMBER=GGMDISPL                                            
  376. //GGMDUMP  EXEC GGCC,MEMBER=GGMDUMP                                             
  377. //GGMESRVR EXEC GGCC,MEMBER=GGMESRVR                                            
  378. //GGMFREEM EXEC GGCC,MEMBER=GGMFREEM                                            
  379. //GGMGETDS EXEC GGCC,MEMBER=GGMGETDS                                            
  380. //GGMGETM  EXEC GGCC,MEMBER=GGMGETM                                             
  381. //GGMGOFOR EXEC GGCC,MEMBER=GGMGOFOR                                            
  382. //GGMGSRVL EXEC GGCC,MEMBER=GGMGSRVL                                            
  383. //GGMIERR  EXEC GGCC,MEMBER=GGMIERR                                             
  384. //GGMIGET  EXEC GGCC,MEMBER=GGMIGET                                             
  385. //GGMISPF  EXEC GGCC,MEMBER=GGMISPF                                             
  386. //GGMIVGET EXEC GGCC,MEMBER=GGMIVGET                                            
  387. //GGMIVPUT EXEC GGCC,MEMBER=GGMIVPUT                                            
  388. //GGMMTFER EXEC GGCC,MEMBER=GGMMTFER                                            
  389. //GGMOUTS  EXEC GGCC,MEMBER=GGMOUTS                                             
  390. //GGMOUTTX EXEC GGCC,MEMBER=GGMOUTTX                                            
  391. //GGMPMSG  EXEC GGCC,MEMBER=GGMPMSG                                             
  392. //GGMPROC  EXEC GGCC,MEMBER=GGMPROC                                             
  393. //GGMPTX   EXEC GGCC,MEMBER=GGMPTX                                              
  394. //GGMSOCKT EXEC GGCC,MEMBER=GGMSOCKT                                            
  395. //GGMSOPT  EXEC GGCC,MEMBER=GGMSOPT                                             
  396. //GGMSSRVR EXEC GGCC,MEMBER=GGMSSRVR                                            
  397. //GGMTNET  EXEC GGCC,MEMBER=GGMTNET                                             
  398. //GGMTSO   EXEC GGCC,MEMBER=GGMTSO                                              
  399. //GGMTYPE  EXEC GGCC,MEMBER=GGMTYPE                                             
  400. //GGMUNALC EXEC GGCC,MEMBER=GGMUNALC                                            
  401. //GGMVTX   EXEC GGCC,MEMBER=GGMVTX                                              
  402. //GGMWAIS  EXEC GGCC,MEMBER=GGMWAIS                                             
  403. //GGMWHOIS EXEC GGCC,MEMBER=GGMWHOIS                                            
  404. //GGMXTX   EXEC GGCC,MEMBER=GGMXTX                                              
  405. //*                                                                             
  406. //* Link GOPHER load module. Like SMP/E, expect return code 8 when              
  407. //* doing this from scratch.  Additional one-or-two-module links                
  408. //* will just replace the corresponding parts of the load module.               
  409. //*                                                                             
  410. //GGLINK EXEC GGLINK                                                            
  411. //LKED.SYSLIN DD DISP=(OLD,DELETE),DSN=&&LOADSET                                
  412. //            DD *                                                              
  413.  INCLUDE SYSLMOD(GGCLIENT)            if included first time, RC = 8            
  414.  INCLUDE SYSLIB(AMPZMVSB)             include if TCP/IP V1 only                 
  415.  ENTRY   CEESTART                                                               
  416.  NAME    GGCLIENT(R)                                                            
  417. /*                                                                              
  418. ./   ADD NAME=COMPILES,SSI=01060050                                             
  419. //JOBNAME  JOB ACCOUNT,'NAME'                                                   
  420. //*                                                                  */         
  421. //* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  422. //*                                                                  */         
  423. //* This software is provided on an "AS IS" basis.  All warranties,  */         
  424. //* including the implied warranties of merchantability and fitness, */         
  425. //* are expressly denied.                                            */         
  426. //*                                                                  */         
  427. //* Provided this copyright notice is included, this software may    */         
  428. //* be freely distributed and not offered for sale.                  */         
  429. //*                                                                  */         
  430. //* Changes or modifications may be made and used only by the maker  */         
  431. //* of same, and not further distributed.  Such modifications should */         
  432. //* be mailed to the author for consideration for addition to the    */         
  433. //* software and incorporation in subsequent releases.               */         
  434. //*                                                                  */         
  435. //*********************************************************************         
  436. //*                                                                             
  437. //* Compile some or all GOPHER C/370 sources to make the SYSLIN input           
  438. //* to the linkedit of the executable Gopher load module.                       
  439. //*                                                                             
  440. //GGCC   PROC MEMBER=,                                                          
  441. //            SRCLIB='GOPHER.C',                 GOPHER C source PDS            
  442. //            HDRLIB='GOPHER.H',                 GOPHER C headers PDS           
  443. //            COMMHDR='TCPIP.COMMMAC',           C/370 TCP/IP headers           
  444. //            C370HDR='SYS1.EDCHDRS',            C/370 standard headers         
  445. //            SYSMSGS='SYS1.EDCMSGS',            C/370 messages file            
  446. //            SYSMSGM='EDCMSGE',                 C/370 message member           
  447. //            VIOUNIT=VIO,                       Temporary disk unit            
  448. //            OUTCLAS='*',                          SYSOUT class                
  449. //            CPARMS='SOURCE EXPMAC NOAGGR NOXREF', Compile parameters          
  450. //            TEST=TEST                             TEST or NOTEST              
  451. //*                                                                             
  452. //CCOMP     EXEC PGM=EDCCOMP,PARM='MARGINS(1,72) &TEST &CPARMS'                 
  453. //SYSMSGS   DD DISP=SHR,DSN=&SYSMSGS(&SYSMSGM)                                  
  454. //SYSIN     DD DISP=SHR,DSN=&SRCLIB(&MEMBER)                                    
  455. //SYSLIB    DD DISP=SHR,DSN=&COMMHDR                                            
  456. //          DD DISP=SHR,DSN=&C370HDR                                            
  457. //USERLIB   DD DISP=SHR,DSN=&HDRLIB                                             
  458. //SYSLIN    DD DSN=&&LOADSET,UNIT=&VIOUNIT,DISP=(MOD,PASS),                     
  459. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  460. //SYSPRINT  DD SYSOUT=&OUTCLAS                                                  
  461. //SYSCPRT   DD SYSOUT=&OUTCLAS                                                  
  462. //SYSUT1    DD DSN=&&SYSUT1,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  463. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  464. //SYSUT4    DD DSN=&&SYSUT4,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  465. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200)                 
  466. //SYSUT6    DD DSN=&&SYSUT6,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  467. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  468. //SYSUT7    DD DSN=&&SYSUT7,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  469. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  470. //SYSUT8    DD DSN=&&SYSUT8,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  471. //   SPACE=(32000,(30,30)),DCB=(RECFM=FB,LRECL=3200,BLKSIZE=12800)              
  472. //SYSUT9    DD DSN=&&SYSUT9,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  473. //   SPACE=(32000,(30,30)),DCB=(RECFM=VB,LRECL=137,BLKSIZE=882)                 
  474. //SYSUT10   DD SYSOUT=&OUTCLAS                                                  
  475. //*                                                                             
  476. //         PEND                                                                 
  477. //*                                                                             
  478. //*********************************************************************         
  479. //*                                                                             
  480. //* Linkedit the executable Gopher load modules.                                
  481. //*                                                                             
  482. //* Note: If TCP/IP V2 or higher, remove the PASCAL link libraries              
  483. //*       from the JCL and the AMPZMVSB card from the control deck.             
  484. //*                                                                             
  485. //GGLINK PROC LOADLIB='GOPHER.LOAD',             Executable load library        
  486. //            EDCBASE='SYS1.SEDCBASE',           C/370  link library            
  487. //            IBMBASE='SYS1.SIBMBASE',           PL/1+C common library          
  488. //            COMMTXT='TCPIP.COMMTXT',           TCP/IP link library            
  489. //            PASRUN3='SYS1.PAS.SAMPRUN3',       PASCAL link library            
  490. //            PASRUN1='SYS1.PAS.SAMPRUN1',       PASCAL link library            
  491. //            PASMSG1='SYS1.PAS.SAMPMSG1',       PASCAL link library            
  492. //            IKJLINK='SYS1.LINKLIB',            IKJEFF18 link library          
  493. //            VIOUNIT=VIO,                       Temporary disk unit            
  494. //            OUTCLAS='*',                          SYSOUT class                
  495. //            LPARMS='LIST,LET,MAP',                Linkedit parameters         
  496. //            TEST=TEST                             TEST or NOTEST              
  497. //*                                                                             
  498. //LKED      EXEC PGM=IEWL,PARM='AMODE(31),&TEST,&LPARMS'                        
  499. //SYSPRINT  DD SYSOUT=&OUTCLAS                                                  
  500. //SYSLIB    DD DISP=SHR,DSN=&EDCBASE                                            
  501. //          DD DISP=SHR,DSN=&IBMBASE                                            
  502. //          DD DISP=SHR,DSN=&COMMTXT                                            
  503. //          DD DISP=SHR,DSN=&PASRUN3  if TCP/IP V1 only                         
  504. //          DD DISP=SHR,DSN=&PASRUN1  if TCP/IP V1 only                         
  505. //          DD DISP=SHR,DSN=&PASMSG1  if TCP/IP V1 only                         
  506. //          DD DISP=SHR,DSN=&IKJLINK  if C/370 V1R1 with #undef FETCH           
  507. //SYSLMOD   DD DISP=SHR,DSN=&LOADLIB                                            
  508. //SYSUT1    DD DSN=&&SYSUT1,UNIT=&VIOUNIT,DISP=(NEW,DELETE),                    
  509. //          SPACE=(32000,(30,30))                                               
  510. //*                                                                             
  511. //         PEND                                                                 
  512. //*                                                                             
  513. //GGMALLOC EXEC GGCC,MEMBER=GGMALLOC                                            
  514. //GGMDFAIL EXEC GGCC,MEMBER=GGMDFAIL                                            
  515. //GGMUNALC EXEC GGCC,MEMBER=GGMUNALC                                            
  516. //GGMOUTS  EXEC GGCC,MEMBER=GGMOUTS                                             
  517. //GGMPROC  EXEC GGCC,MEMBER=GGMPROC                                             
  518. //GGSTASK  EXEC GGCC,MEMBER=GGSTASK                                             
  519. //*                                                                             
  520. //* Link GOPHER subtask module.  Like SMP/E, expect return code 8               
  521. //* doing this from scratch.  Additional one-or-two-module links                
  522. //* will just replace the corresponding parts of the load module.               
  523. //*                                                                             
  524. //* If recompiling the entire load module, you may want to delete               
  525. //* the previous one from the SYSLMOD library first, or remove the              
  526. //* INCLUDE SYSLMOD card from the JCL below.                                    
  527. //*                                                                             
  528. //GGLINKT EXEC GGLINK                                                           
  529. //LKED.SYSLIN DD DISP=(OLD,DELETE),DSN=&&LOADSET                                
  530. //            DD *                                                              
  531.  INCLUDE SYSLMOD(GGSTASK)             if included first time, RC = 8            
  532.  INCLUDE SYSLIB(AMPZMVSB)             include if TCP/IP V1 only                 
  533.  INCLUDE SYSLIB(IUCVFORC)                                                       
  534.  INCLUDE SYSLIB(EDCMTFS)                                                        
  535.  ENTRY   CEESTART                                                               
  536.  NAME    GGSTASK(R)                                                             
  537. /*                                                                              
  538. //GGMMTFER EXEC GGCC,MEMBER=GGMMTFER                                            
  539. //GGSERVER EXEC GGCC,MEMBER=GGSERVER                                            
  540. //*                                                                             
  541. //* Link GOPHER server module.  Like SMP/E, expect return code 8                
  542. //* doing this from scratch.  Additional one-or-two-module links                
  543. //* will just replace the corresponding parts of the load module.               
  544. //*                                                                             
  545. //* If recompiling the entire load module, you may want to delete               
  546. //* the previous one from the SYSLMOD library first, or remove the              
  547. //* INCLUDE SYSLMOD card from the JCL below.                                    
  548. //*                                                                             
  549. //GGLINKS EXEC GGLINK                                                           
  550. //LKED.SYSLIN DD DISP=(OLD,DELETE),DSN=&&LOADSET                                
  551. //            DD *                                                              
  552.  INCLUDE SYSLMOD(GGSERVER)            if included first time, RC = 8            
  553.  INCLUDE SYSLIB(AMPZMVSB)             include if TCP/IP V1 only                 
  554.  ENTRY   CEESTART                                                               
  555.  NAME    GGSERVER(R)                                                            
  556. /*                                                                              
  557. ./   ADD NAME=GOPHERD,SSI=01060032                                              
  558. //GOPHERD  PROC MODULE=GGSERVER,                                        00010000
  559. //         STEPLIB='GOPHER.LOAD',                                       00020000
  560. //         EXECLIB='GOPHER.EXEC',                                       00030000
  561. //         ACCESS='GOPHER.ACCESS',                                      00040000
  562. //         ABOUT='GOPHER.ABOUT',                                        00050000
  563. //         MENU='GOPHER.MENU',                                          00050000
  564. //         GPARM=                                                       00050000
  565. //*                                                                     00060000
  566. //********************************************************************* 00070000
  567. //*                                                                   * 00080000
  568. //* GOPHER daemon, by Shawn Hart (U.Del.) and Steve Bacher (D.Lab.)   * 00090000
  569. //*                                                                   * 00100000
  570. //* Straight batch (no TSO access)                                    * 00100000
  571. //*                                                                   * 00100000
  572. //********************************************************************* 00110000
  573. //*                                                                     00120000
  574. //GOPHERD  EXEC PGM=&MODULE,PARM='&GPARM'                               00150001
  575. //STEPLIB  DD   DISP=SHR,DSN=&STEPLIB                                   00170000
  576. //GGEXEC   DD   DISP=SHR,DSN=&EXECLIB                                   00181002
  577. //SYSTSPRT DD   UNIT=SYSVIO,SPACE=(TRK,(100,100)),RECFM=VBA,LRECL=255   00190000
  578. //SYSERR   DD   SYSOUT=*                                                00200000
  579. //SYSPRINT DD   SYSOUT=*                                                00210000
  580. //SYSTSIN  DD   DUMMY                                                   00210000
  581. //SYSIN    DD   DUMMY                                                   00210000
  582. //GGDEBUG  DD   SYSOUT=*                                                00230000
  583. //GGABOUT  DD   DISP=SHR,DSN=&ABOUT                                     00230000
  584. //GGACCESS DD   DISP=SHR,DSN=&ACCESS                                    00240000
  585. //GGGOPHER DD   DISP=SHR,DSN=&MENU                                      00250000
  586. ./   ADD NAME=GOPHERT,SSI=01040057                                              
  587. //GOPHERD  PROC MODULE=GGSERVER,                                        00010000
  588. //         STEPLIB='GOPHER.LOAD',                                       00020000
  589. //         EXECLIB='GOPHER.EXEC',                                       00030000
  590. //         ACCESS='GOPHER.ACCESS',                                      00040000
  591. //         ABOUT='GOPHER.ABOUT',                                        00050000
  592. //         MENU='GOPHER.MENU',                                          00050000
  593. //         GPARM=                                                       00050000
  594. //*                                                                     00060000
  595. //********************************************************************* 00070000
  596. //*                                                                   * 00080000
  597. //* GOPHER daemon, by Shawn Hart (U.Del.) and Steve Bacher (D.Lab.)   * 00090000
  598. //*                                                                   * 00100000
  599. //********************************************************************* 00110000
  600. //*                                                                     00120000
  601. //GOPHERD  EXEC PGM=IKJEFT01,DYNAMNBR=128,REGION=8M,                    00150001
  602. //         PARM='&MODULE &GPARM'                                        00160000
  603. //STEPLIB  DD   DISP=SHR,DSN=&STEPLIB                                   00170000
  604. //GGEXEC   DD   DISP=SHR,DSN=&EXECLIB                                   00181002
  605. //SYSTSPRT DD   UNIT=SYSVIO,SPACE=(TRK,(100,100)),RECFM=VBA,LRECL=255   00190000
  606. //SYSERR   DD   SYSOUT=*                                                00200000
  607. //SYSPRINT DD   SYSOUT=*                                                00210000
  608. //SYSTSIN  DD   DUMMY                                                   00220000
  609. //SYSIN    DD   DUMMY                                                   00230000
  610. //GGDEBUG  DD   SYSOUT=*                                                00230000
  611. //GGABOUT  DD   DISP=SHR,DSN=&ABOUT                                     00230000
  612. //GGACCESS DD   DISP=SHR,DSN=&ACCESS                                    00240000
  613. //GGGOPHER DD   DISP=SHR,DSN=&MENU                                      00250000
  614. ./   ADD NAME=HELP,SSI=01000051                                                 
  615. )F Function -                                                                   
  616.                                                                                 
  617.  GOPHER is a distributed document delivery service, or, more generally,         
  618.  a networked information retrieval service.  It allows you to access            
  619.  numerous types of data on various hosts in a transparent fashion.              
  620.  GOPHER presents you with a hierarchical display of information sources         
  621.  which are accessed via a client/server communications link.                    
  622.                                                                                 
  623.  There are GOPHER clients for all common hardware platforms.  The MVS           
  624.  version runs as an ISPF dialog application.                                    
  625.                                                                                 
  626.  When you use the GOPHER client, information about your use of GOPHER           
  627.  is stored in a data set called GOPHERRC.  If you don't have one,               
  628.  GOPHER will create it for you.                                                 
  629.                                                                                 
  630.  For more information on customizing your GOPHER environment, get               
  631.  into Gopher and select "About This GOPHER".                                    
  632.                                                                                 
  633. )I GOPHLOC          - local GOPHER help goes in member GOPHLOC                  
  634.                                                                                 
  635. )X Syntax -                                                                     
  636.                                                                                 
  637.    %GOPHER                                                                      
  638.               LOCAL                                                             
  639.               SERVER(hostname)                                                  
  640.               PATH(pathname)                                                    
  641.               PORT(portnumber)                                                  
  642.               DESCRIPTION(text)                                                 
  643.               FORCE                                                             
  644.               DEBUG                                                             
  645.               TEST                                                              
  646.                                                                                 
  647.    Required:  none                                                              
  648.                                                                                 
  649. )O Operands -                                                                   
  650.                                                                                 
  651. ))LOCAL                                                                         
  652.                                                                                 
  653.               Specify LOCAL if you want to enter GOPHER in "serverless"         
  654.               mode - i.e. start up with your private GOPHER menu.               
  655.               Specifying LOCAL accomplishes two things:                         
  656.                                                                                 
  657.                (1) It sets the server to "-", meaning local access.             
  658.                    Therefore, you must also provide a path, either              
  659.                    via the PATH operand or via a "localmenu:" spec              
  660.                    in your GOPHERRC file.                                       
  661.                                                                                 
  662.                (2) It allows you to use GOPHER even if there are                
  663.                    other TCP/IP socket applications active elsewhere            
  664.                    in your TSO session.  However, it will not allow             
  665.                    you to connect to any GOPHER servers, even if you            
  666.                    have a local menu item that points to one.                   
  667.                                                                                 
  668.               For information on how to set up GOPHER menus, get into           
  669.               GOPHER and select "About This Gopher".                            
  670.                                                                                 
  671. ))SERVER(hostname)                                                              
  672.                                                                                 
  673.               The host name (or IP address) of a Gopher server.                 
  674.               If this is not given, GOPHER looks in your GOPHERRC               
  675.               to find what server to connect to.  If it can't find              
  676.               an appropriate specification, you will have to enter              
  677.               a server name on the startup panel.                               
  678.                                                                                 
  679.               A server name of a single minus sign (-) is a special             
  680.               case, signifying local (serverless) access to your                
  681.               own private GOPHER data.  In this case, you must tell             
  682.               GOPHER where your menu is, either via the PATH operand            
  683.               or in the GOPHERRC file.                                          
  684.                                                                                 
  685. ))PATH(pathname)                                                                
  686.                                                                                 
  687.               The path name to be passed to the Gopher server, or               
  688.               used in local access as your initial menu.  Although              
  689.               the exact interpretation of the pathname string varies            
  690.               depending on the server, both the MVS server and the              
  691.               local GOPHER access feature interpret the pathname                
  692.               as the FULLY QUALIFIED WITHOUT QUOTES name of an MVS              
  693.               data set containing a gopher menu.  For information               
  694.               about the format of a gopher menu, see operand MENU.              
  695.                                                                                 
  696. ))PORT(portnumber)                                                              
  697.                                                                                 
  698.               You should never need to specify this field unless                
  699.               someone has set up a special kind of Gopher server                
  700.               that requires a unique port number.                               
  701.                                                                                 
  702. ))DESCRIPTION(text)                                                             
  703.                                                                                 
  704.               A text string giving the heading to be displayed for              
  705.               the initial directory of Gopher goodies.  Normally                
  706.               either the Gopher server or the Gopher client will                
  707.               have a default value for this, or you can specify                 
  708.               a description of your liking in your GOPHERRC file.               
  709.                                                                                 
  710. ))FORCE                                                                         
  711.                                                                                 
  712.               GOPHER tries to determine if there is a TCP/IP socket             
  713.               application active elsewhere in your TSO environment              
  714.               before starting up, to prevent TCP/IP errors.  If it              
  715.               tells you that there is another client active but in              
  716.               truth there is none and you know it, you can use the              
  717.               FORCE keyword to make GOPHER proceed whether it finds             
  718.               this to be the case or not.                                       
  719.                                                                                 
  720.               Using the LOCAL operand is one way to avoid this entire           
  721.               scenario.  However, that won't allow you to access any            
  722.               Gopher servers on the network.                                    
  723.                                                                                 
  724. ))DEBUG                                                                         
  725.                                                                                 
  726.               Set debugging mode on.  You must preallocate a file to            
  727.               ddname GGDEBUG for this to work.  This can be allocated           
  728.               to the terminal or a log file.  When debug mode is on,            
  729.               messages describing memory allocation and deallocation            
  730.               and GOPHER queries sent are dumped to the debug file.             
  731.                                                                                 
  732. ))TEST                                                                          
  733.                                                                                 
  734.               Activate C/370 interactive test (INSPECT).  GOPHER must           
  735.               have been compiled with the TEST option for this to be            
  736.               effective.  Note that you can also issue the TEST command         
  737.               inside GOPHER to get to INSPECT, again provided that              
  738.               GOPHER was compiled with the TEST option.                         
  739.                                                                                 
  740. ./   ADD NAME=HELQ,SSI=01000025                                                 
  741. )F Function -                                                                   
  742.                                                                                 
  743.  GOPHER is a distributed document delivery service, or, more generally,         
  744.  a networked information retrieval service.  It allows you to access            
  745.  numerous types of data on various hosts in a transparent fashion.              
  746.  GOPHER presents you with a hierarchical display of information sources         
  747.  which are accessed via a client/server communications link.                    
  748.                                                                                 
  749.  There are GOPHER clients for all common hardware platforms.  The MVS           
  750.  version runs as an ISPF dialog application.                                    
  751.                                                                                 
  752.  When you use the GOPHER client, information about your use of GOPHER           
  753.  is stored in a data set called GOPHERRC.  If you don't have one,               
  754.  GOPHER will create it for you.                                                 
  755.                                                                                 
  756.  For more information on customizing your GOPHER environment, get               
  757.  into Gopher and select "About This GOPHER".                                    
  758.                                                                                 
  759. )I GOPHLOC          - local GOPHER help goes in member GOPHLOC                  
  760.                                                                                 
  761. )X Syntax -                                                                     
  762.                                                                                 
  763.    %GOPHER                                                                      
  764.               LOCAL                                                             
  765.               FORCE                                                             
  766.               DEBUG                                                             
  767.               TEST                                                              
  768.                                                                                 
  769.    Required:  none                                                              
  770.                                                                                 
  771. )O Operands -                                                                   
  772.                                                                                 
  773. ))LOCAL                                                                         
  774.                                                                                 
  775.               Specify LOCAL if you want to enter GOPHER in "serverless"         
  776.               mode - i.e. start up with your private GOPHER menu.               
  777.               Specifying LOCAL accomplishes two things:                         
  778.                                                                                 
  779.                (1) It sets the server to "-", meaning local access.             
  780.                    Therefore, you must also provide a path via a                
  781.                    "localmenu:" spec in your GOPHERRC file.                     
  782.                                                                                 
  783.                (2) It allows you to use GOPHER even if there are                
  784.                    other TCP/IP socket applications active elsewhere            
  785.                    in your TSO session.  However, it will not allow             
  786.                    you to connect to any GOPHER servers, even if you            
  787.                    have a local menu item that points to one.                   
  788.                                                                                 
  789.               For information on how to set up GOPHER menus, get into           
  790.               GOPHER and select "About This Gopher".                            
  791.                                                                                 
  792. ))FORCE                                                                         
  793.                                                                                 
  794.               GOPHER tries to determine if there is a TCP/IP socket             
  795.               application active elsewhere in your TSO environment              
  796.               before starting up, to prevent TCP/IP errors.  If it              
  797.               tells you that there is another client active but in              
  798.               truth there is none and you know it, you can use the              
  799.               FORCE keyword to make GOPHER proceed whether it finds             
  800.               this to be the case or not.                                       
  801.                                                                                 
  802.               Using the LOCAL operand is one way to avoid this entire           
  803.               scenario.  However, that won't allow you to access any            
  804.               Gopher servers on the network.                                    
  805.                                                                                 
  806. ))DEBUG                                                                         
  807.                                                                                 
  808.               Set debugging mode on.  You must preallocate a file to            
  809.               ddname GGDEBUG for this to work.  This can be allocated           
  810.               to the terminal or a log file.  When debug mode is on,            
  811.               messages describing memory allocation and deallocation            
  812.               and GOPHER queries sent are dumped to the debug file.             
  813.                                                                                 
  814. ))TEST                                                                          
  815.                                                                                 
  816.               Activate C/370 interactive test (INSPECT).  GOPHER must           
  817.               have been compiled with the TEST option for this to be            
  818.               effective.  Note that you can also issue the TEST command         
  819.               inside GOPHER to get to INSPECT, again provided that              
  820.               GOPHER was compiled with the TEST option.                         
  821.                                                                                 
  822. ./   ADD NAME=INSTALLC,SSI=01070035                                             
  823.                                                                                 
  824.  Directions for Installing the GOPHER MVS Client                                
  825.                                                                                 
  826.  Assuming the PDS's have been created:                                          
  827.                                                                                 
  828.  1. Customize the ALLOAD and COMPILEC JCL members to reflect your               
  829.  local conventions.  Note:  If you intend to place the executable into          
  830.  an existing library, you can suppress that part of the ALLOAD JCL.             
  831.  The name of the data set created must match across both members.               
  832.                                                                                 
  833.  2. Customize the GGUSER header file as shown by the comments therein.          
  834.  Note in particular the defines for your TCP/IP and your C compiler.            
  835.  There are changes to the linkedit JCL that are related to these.               
  836.                                                                                 
  837.  3.  Customize the GOPHER exec to define the names of the MVS libraries         
  838.  to contain the panel and load library members.  The load library must          
  839.  be the one specified in the ALLOAD JCL, if you are creating it anew.           
  840.  Observe the comments relating to the use of LIBDEF and ISPF APPLIDs.           
  841.                                                                                 
  842.  It is in the GOPHER exec that you will also customize the name of the          
  843.  default Gopher server.  Note that the user's GOPHERRC file gets built          
  844.  from the contents of this exec.                                                
  845.                                                                                 
  846.  Note that if you install one of the REXX execs, you must also install          
  847.  the NNMFIUCV exec in the same library.  This exec implements a rude            
  848.  check for an existing TCP/IP socket application (e.g. another GOPHER)          
  849.  in a different PIE MultiTSO session.  It prevents your users from              
  850.  crashing TCP/IP, so it is highly recommended that you make use of it.          
  851.                                                                                 
  852.  4. If you are running ISPF Version 2 or earlier, edit the GOPHER panels        
  853.  whose names begin "GGMP...".  These are popups, and will not work              
  854.  under ISPF Version 2 unless you change the )BODY line.  Remove the             
  855.  WINDOW(...) parameter from the )BODY line of each panel so that the            
  856.  line just says )BODY or )BODY EXPAND(``), as the case may be.                  
  857.                                                                                 
  858.  Now, to install:                                                               
  859.                                                                                 
  860.  5. Submit the ALLOAD JCL to allocate the load library from which the           
  861.  executable program will be run.  If you intend to place the executable         
  862.  into an existing library, you can skip this step, but you should make          
  863.  sure that there is no previous load module named GGCLIENT in the load          
  864.  library of your choice before you proceed.                                     
  865.                                                                                 
  866.  6. Submit the COMPILEC JCL to compile all the C sources and create             
  867.  the executable Gopher load module.                                             
  868.                                                                                 
  869.  The first time you run this you can expect a return code of 8 from             
  870.  the linkedit.  Like SMP/E, this is OK if the only reason is an IEW0342         
  871.  because the "INCLUDE SYSLMOD(GGCLIENT)" did not find an existing load          
  872.  module.  If you get IEW0132 (unresolved external reference) or                 
  873.  IEW0241 (ESD type definition conflict), your linkedit went awry.               
  874.  Don't use the resultant load module.  Check the libraries you                  
  875.  specified on the link step to see what went wrong.                             
  876.                                                                                 
  877.  In the future, if you have to recompile individual modules, you can use        
  878.  the same JCL to compile only those modules, and the link will include          
  879.  the new modules in the existing executable load module.                        
  880.                                                                                 
  881.  *********************************************************************          
  882.                                                                                 
  883.  IMPORTANT:  If you are running TCP/IP V2R2 or higher on MVS, you must          
  884.  change the following library names in the compile and link JCL:                
  885.                                                                                 
  886.    TCPIP.COMMMAC   should be changed to  TCPIP.SEZACMAC                         
  887.    TCPIP.COMMTXT   should be changed to  TCPIP.SEZACMTX                         
  888.                                                                                 
  889.  If you are using SNS/TCPAccess, use these library names, or                    
  890.  whatever names are defined at your installation:                               
  891.                                                                                 
  892.    TCPIP.COMMMAC   should be changed to  SNSTCP.V110.H                          
  893.    TCPIP.COMMTXT   should be changed to  SNSTCP.V110.CILIB                      
  894.                                                                                 
  895.  *********************************************************************          
  896.                                                                                 
  897.  Note:  If you have defined C370V1 in the GGUSER header file, you must          
  898.  also include the system linklist load library or libraries containing          
  899.  ISPLINK, ISPEXEC and IKJEFF18 when linking.  Otherwise you may delete          
  900.  the lines from the linkedit JCL that reference them.                           
  901.                                                                                 
  902.  Note:  You need not include the PASCAL libraries or the AMPZMVSB               
  903.  module if you are using TCP/IP Version 2 or higher, in which case              
  904.  you must also define TCPIPV2 in the GGUSER headerfile.                         
  905.                                                                                 
  906.  7. Copy all the members of the panel PDS into the ISPF panel library           
  907.  specified in the GOPHER exec.                                                  
  908.                                                                                 
  909.  8. Copy one of the help members (HELP or HELQ) from the CNTL PDS into          
  910.  your local TSO HELP library under the name GOPHER.  You may also               
  911.  create an additional HELP member called GOPHLOC containing                     
  912.  information local to your site, if you wish.                                   
  913.                                                                                 
  914.  Which CNTL member should you use?  If you don't have XPROC, use HELQ.          
  915.  If you do have XPROC, use HELP.  You will have to modify your GOPHER           
  916.  clist either way.  If you don't have XPROC, you should get it,                 
  917.  because you can specify more options on Gopher if you do.  You can             
  918.  get XPROC via USC's "MVS network server" code distribution service.            
  919.  For more information about this, send an email message to                      
  920.  SERVICE@MVSA.USC.EDU - or SERVICE@USCMVSA, which will normally give            
  921.  better results if you have a BITNET (NJE) return address.                      
  922.                                                                                 
  923.  9. Create the "About This Gopher" PDS from the ABOUT PDS.  This has            
  924.  all the text users should see when they select the "About This Gopher"         
  925.  item from the MVS client.  It also contains all the documentation you          
  926.  need about setting up the client and the server, as well as creating           
  927.  menus and REXX execs for use with MVS Gopher.  You may have already            
  928.  done this as part of the server install, but it should also be                 
  929.  available from the client in "local" (serverless) mode, so that is             
  930.  why I mention it here.                                                         
  931.                                                                                 
  932. --------------------------------------------------------------------            
  933.                                                                                 
  934.  Note:  Make sure that the C/370 run time library is available,                 
  935.  either in the system link list or in the ISPLLIB concatenation,                
  936.  before attempting to run GOPHER.                                               
  937.                                                                                 
  938.  If the C/370 runtime library is not in the link list or otherwise              
  939.  available to ISPF at execution time, you may arrange for it to be              
  940.  allocated via LIBDEF in the GOPHER exec (I haven't tried this).                
  941.                                                                                 
  942. ./   ADD NAME=INSTALLS,SSI=01080018                                             
  943.                                                                                 
  944.  Directions for Installing the GOPHER MVS Server                                
  945.                                                                                 
  946.  Assuming the PDS's have been created:                                          
  947.                                                                                 
  948.  1. Customize the ALLOAD and COMPILES JCL members to reflect your               
  949.  local conventions.  Note:  If you intend to place the executable into          
  950.  an existing library, you can suppress that part of the ALLOAD JCL.             
  951.  The name of the data set created must match across both members.               
  952.                                                                                 
  953.  2. Customize the GGUSER header file as shown by the comments therein.          
  954.  Note in particular the defines for your TCP/IP and your C compiler.            
  955.  There are changes to the linkedit JCL that are related to these.               
  956.                                                                                 
  957.  Now, to install:                                                               
  958.                                                                                 
  959.  3. Submit the ALLOAD JCL to allocate the load library from which the           
  960.  executable program will be run.  If you intend to place the executable         
  961.  into an existing library, you can skip this step, but you should make          
  962.  sure that there is no previous load module named GGSERVER or GGSTASK           
  963.  in the load library of your choice before you proceed.                         
  964.                                                                                 
  965.  4. Submit the COMPILES JCL to compile all the C sources and create             
  966.  the executable Gopher load modules.                                            
  967.                                                                                 
  968.  The first time you run this you can expect return codes of 8 from              
  969.  the linkedit.  Like SMP/E, this is OK if the only reason is an IEW0342         
  970.  because the "INCLUDE SYSLMOD(...)" did not find an existing load               
  971.  module.  If you get IEW0132 (unresolved external reference) or                 
  972.  IEW0241 (ESD type definition conflict), your linkedit went awry.               
  973.  Don't use the resultant load module.  Check the libraries you                  
  974.  specified on the link step to see what went wrong.                             
  975.                                                                                 
  976.  In the future, if you have to recompile individual modules, you can use        
  977.  the same JCL to compile only those modules, and the link will include          
  978.  the new modules in the existing executable load module.                        
  979.                                                                                 
  980.  *********************************************************************          
  981.                                                                                 
  982.  IMPORTANT:  If you are running TCP/IP V2R2 or higher on MVS, you must          
  983.  change the following library names in the compile and link JCL:                
  984.                                                                                 
  985.    TCPIP.COMMMAC   should be changed to  TCPIP.SEZACMAC                         
  986.    TCPIP.COMMTXT   should be changed to  TCPIP.SEZACMTX                         
  987.                                                                                 
  988.  If you are using SNS/TCPAccess, use these library names, or                    
  989.  whatever names are defined at your installation:                               
  990.                                                                                 
  991.    TCPIP.COMMMAC   should be changed to  SNSTCP.V110.H                          
  992.    TCPIP.COMMTXT   should be changed to  SNSTCP.V110.CILIB                      
  993.                                                                                 
  994.  *********************************************************************          
  995.                                                                                 
  996.  Note:  If you have defined C370V1 in the GGUSER header file, you must          
  997.  also include the system linklist load library containing IKJEFF18              
  998.  when linking.  Otherwise you may delete the line from the linkedit             
  999.  JCL that references it.                                                        
  1000.                                                                                 
  1001.  Note:  You need not include the PASCAL libraries or the AMPZMVSB               
  1002.  module if you are using TCP/IP Version 2 or higher, in which case              
  1003.  you must also define TCPIPV2 in the GGUSER headerfile.                         
  1004.                                                                                 
  1005.  5. Create the "About This Gopher" PDS from the ABOUT PDS.  This has            
  1006.  all the text users should see when they select the "About This Gopher"         
  1007.  item from the MVS client.  It also contains all the documentation you          
  1008.  need about setting up the client and the server, as well as creating           
  1009.  menus and REXX execs for use with MVS Gopher.  You may have already            
  1010.  done this as part of the client install.                                       
  1011.                                                                                 
  1012.  *** NOTE: In member MENU, you must change the line that reads                  
  1013.  "PATH=GOPHER.ABOUT.PDS(ABOUT)" to reflect the actual name of your              
  1014.  ABOUT PDS.  If you are using an earlier distribution of the MVS                
  1015.  Gopher server that has the line PATH=DD:GGABOUT(ABOUT), then you               
  1016.  must change that as well, because that won't work to get additional            
  1017.  PDS members as the user climbs down the Gopher tree.                           
  1018.                                                                                 
  1019.  6. Create your Gopher access file.  See the instructions in the                
  1020.  "About This Gopher" PDS for the format.                                        
  1021.                                                                                 
  1022.  7. Create the MVS Gopher started task JCL from either of the samples           
  1023.  given in GOPHERD and GOPHERT.  The GOPHERT is recommended so that you          
  1024.  can use REXX execs that issue TSO commands, but you may not want to            
  1025.  use this for security reasons.  Either way, customize liberally.               
  1026.                                                                                 
  1027.  Started task parameters:                                                       
  1028.                                                                                 
  1029.  MODULE=GGSERVER            the Gopher server load module in STEPLIB            
  1030.  STEPLIB='GOPHER.LOAD'      the load library containing the above               
  1031.  EXECLIB='GOPHER.EXEC'      the PDS containing server REXX execs                
  1032.  ACCESS='GOPHER.ACCESS'     the installation access file (sequential)           
  1033.  ABOUT='GOPHER.ABOUT'       the PDS containing "About This Gopher" info         
  1034.  MENU='GOPHER.MENU'         the initial gopher menu (sequential)                
  1035.  GPARM=                     the server parameters (e.g. -d for debug)           
  1036.                                                                                 
  1037.  Note: if you specify GPARM='-D', a GGDEBUG DD must be included.                
  1038.                                                                                 
  1039. --------------------------------------------------------------------            
  1040.                                                                                 
  1041.  Note:  Make sure that the C/370 run time library is available,                 
  1042.  either in the system link list or in the STEPLIB concatenation,                
  1043.  before attempting to run GOPHER.                                               
  1044.                                                                                 
  1045. ./   ADD NAME=MENU,SSI=01020056                                                 
  1046. gopher_menu                                                                     
  1047.                                                                                 
  1048. TYPE=FILE                                                                       
  1049. NAME=About This Gopher                                                          
  1050. PATH=GOPHER.ABOUT.PDS(ABOUT)                                                    
  1051. HOST=+                                                                          
  1052. END                                                                             
  1053.                                                                                 
  1054. TYPE=DIRECTORY                                                                  
  1055. NAME=Library/Information Services                                               
  1056. PATH=SYS0008.GOPHER.LIBRARY(LIBRS)                                              
  1057. HOST=MVS.UDEL.EDU                                                               
  1058. END                                                                             
  1059.                                                                                 
  1060. TYPE=TELNET                                                                     
  1061. NAME=UDINFO - University of Delaware Information                                
  1062. HOST=UDINFO.UDEL.EDU                                                            
  1063. END                                                                             
  1064.                                                                                 
  1065. TYPE=DIRECTORY                                                                  
  1066. NAME=Network and System Services Computer Systems                               
  1067. PATH=SYS0008.GOPHER.DIR(UDTELNET)                                               
  1068. HOST=MVS.UDEL.EDU                                                               
  1069. END                                                                             
  1070.                                                                                 
  1071. TYPE=DIRECTORY                                                                  
  1072. NAME=Weather Across the Country                                                 
  1073. PATH=1/Weather                                                                  
  1074. HOST=mermaid.micro.umn.edu                                                      
  1075. PORT=150                                                                        
  1076. END                                                                             
  1077.                                                                                 
  1078. TYPE=DIRECTORY                                                                  
  1079. NAME=Other Gopher and Information Servers                                       
  1080. PATH=1/Other Gopher and Information Servers                                     
  1081. HOST=gopher.micro.umn.edu                                                       
  1082. END                                                                             
  1083.                                                                                 
  1084. TYPE=DIRECTORY                                                                  
  1085. NAME=How to use BITNET LISTSERV Servers                                         
  1086. PATH=SYS0008.GOPHER.DIR(LISTSERV)                                               
  1087. HOST=MVS.UDEL.EDU                                                               
  1088. END                                                                             
  1089.                                                                                 
  1090. TYPE=DIRECTORY                                                                  
  1091. NAME=University of Delaware Newspapers                                          
  1092. PATH=SYS0008.GOPHER.DIR(PAPERS)                                                 
  1093. HOST=MVS.UDEL.EDU                                                               
  1094. END                                                                             
  1095.                                                                                 
  1096. /*                                                                              
  1097. ./ ENDUP                                                                        
  1098. ?!                                                                              
  1099. //ABOUT    EXEC GGLOAD,TRK1='5',TO='ABOUT'                                      
  1100. //SYSIN    DD DATA,DLM='?!'                                                     
  1101. ./   ADD NAME=ABOUT,SSI=01040045                                                
  1102. gopher_menu                                                                     
  1103.                                                                                 
  1104. TYPE=FILE                                                                       
  1105. NAME=What Is Gopher?                                                            
  1106. PATH=(ABOUTW)                                                                   
  1107. HOST=+                                                                          
  1108. END                                                                             
  1109.                                                                                 
  1110. TYPE=FILE                                                                       
  1111. NAME=Gopher FAQ (Frequently Asked Questions) List                               
  1112. PATH=(FAQ)                                                                      
  1113. HOST=+                                                                          
  1114. END                                                                             
  1115.                                                                                 
  1116. TYPE=DIRECTORY                                                                  
  1117. NAME=Using The Gopher MVS Client                                                
  1118. PATH=(ABOUTC)                                                                   
  1119. HOST=+                                                                          
  1120. END                                                                             
  1121.                                                                                 
  1122. TYPE=DIRECTORY                                                                  
  1123. NAME=Administering the Gopher MVS Server                                        
  1124. PATH=(ABOUTS)                                                                   
  1125. HOST=+                                                                          
  1126. END                                                                             
  1127.                                                                                 
  1128.                                                                                 
  1129. ./   ADD NAME=ABOUTC,SSI=01030000                                               
  1130. gopher_menu                                                                     
  1131.                                                                                 
  1132. TYPE=FILE                                                                       
  1133. NAME=Overview - Using Gopher on MVS                                             
  1134. PATH=(ABOUTCO)                                                                  
  1135. HOST=+                                                                          
  1136. END                                                                             
  1137.                                                                                 
  1138. TYPE=FILE                                                                       
  1139. NAME=Directory Mode - Viewing a Gopher Directory                                
  1140. PATH=(ABOUTCD)                                                                  
  1141. HOST=+                                                                          
  1142. END                                                                             
  1143.                                                                                 
  1144. TYPE=FILE                                                                       
  1145. NAME=File Mode - Browsing a Gopher File                                         
  1146. PATH=(ABOUTCF)                                                                  
  1147. HOST=+                                                                          
  1148. END                                                                             
  1149.                                                                                 
  1150. TYPE=FILE                                                                       
  1151. NAME=Query Mode - Executing a Gopher Query                                      
  1152. PATH=(ABOUTCQ)                                                                  
  1153. HOST=+                                                                          
  1154. END                                                                             
  1155.                                                                                 
  1156. TYPE=FILE                                                                       
  1157. NAME=Extracting Gopher Text                                                     
  1158. PATH=(ABOUTCX)                                                                  
  1159. HOST=+                                                                          
  1160. END                                                                             
  1161.                                                                                 
  1162. TYPE=DIRECTORY                                                                  
  1163. NAME=Customizing Your Gopher Startup                                            
  1164. PATH=(ABOUTCS)                                                                  
  1165. HOST=+                                                                          
  1166. END                                                                             
  1167.                                                                                 
  1168.                                                                                 
  1169. ./   ADD NAME=ABOUTCD,SSI=01000031                                              
  1170. This text has not been written yet.                                             
  1171. ./   ADD NAME=ABOUTCF,SSI=01000042                                              
  1172. This text has not been written yet.                                             
  1173. ./   ADD NAME=ABOUTCO,SSI=01000013                                              
  1174. The following is modified from Allan Tuchman's XGOPHER help.                    
  1175.                                                                                 
  1176. Gopher on MVS is an ISPF dialog interface to the Gopher                         
  1177. information delivery system from the University of Minnesota.                   
  1178.                                                                                 
  1179. The initial panel asks you to specify the name of the Gopher server             
  1180. host.  Normally you leave the other input fields alone.                         
  1181.                                                                                 
  1182. You may also specify a hostname of "-", which means that you want               
  1183. to use your own private Gopher data without going through a server.             
  1184. When you do this, you must provide the path name to your private                
  1185. top-level menu (data set name, FULLY QUALIFIED, WITHOUT QUOTES).                
  1186.                                                                                 
  1187. Assuming that the top-level path points to a valid Gopher menu,                 
  1188. the initial display will show the top level directory of                        
  1189. gopher information available.  Selecting an item from this                      
  1190. list will fetch the contents of a file, subdirectory, or                        
  1191. other information.  The directory display may be updated to                     
  1192. show the new subdirectory.                                                      
  1193.                                                                                 
  1194. To select an item, type "S" in front of it and press ENTER.                     
  1195. This puts you into ISPF BROWSE mode on the text of the item.                    
  1196. You may also type "Q" in front of an item to see it in text format              
  1197. even if it is a directory.  If you have retrieved an item, you may              
  1198. type "E" in front of it to extract it into a file - but you may                 
  1199. do this more easily via the EXTract command from within BROWSE.                 
  1200.                                                                                 
  1201. Some gopher file types are not supported by the current client.                 
  1202. These will not appear on your menus.  Furthermore, you may not                  
  1203. be permitted to access some items, depending upon the server                    
  1204. and the host from which you are trying to access them.  These                   
  1205. restrictions do not apply to local mode, where you can access                   
  1206. anything that you have local permission to read.                                
  1207.                                                                                 
  1208. The Gopher MVS client is written by Steve Bacher at Draper Laboratory           
  1209. (copyright 1992).                                                               
  1210.                                                                                 
  1211. ./   ADD NAME=ABOUTCQ,SSI=01000047                                              
  1212. This text has not been written yet.                                             
  1213. ./   ADD NAME=ABOUTCS,SSI=01030002                                              
  1214. gopher_menu                                                                     
  1215.                                                                                 
  1216. Type=FILE                                                                       
  1217. Name=Customizing Your Gopher Startup                                            
  1218. Path=(ABOUTCSC)                                                                 
  1219. Host=+                                                                          
  1220. End                                                                             
  1221.                                                                                 
  1222. Type=FILE                                                                       
  1223. Name=What Happens When You Start Up Gopher                                      
  1224. Path=(ABOUTCSW)                                                                 
  1225. Host=+                                                                          
  1226. End                                                                             
  1227.                                                                                 
  1228. Type=FILE                                                                       
  1229. Name=Requesting Local (Serverless) Access                                       
  1230. Path=(ABOUTCSL)                                                                 
  1231. Host=+                                                                          
  1232. End                                                                             
  1233.                                                                                 
  1234. Type=FILE                                                                       
  1235. Name=The GOPHERRC File                                                          
  1236. Path=(ABOUTCSR)                                                                 
  1237. Host=+                                                                          
  1238. End                                                                             
  1239.                                                                                 
  1240. Type=FILE                                                                       
  1241. Name=Defining GOPHER Menus                                                      
  1242. Path=(ABOUTCSM)                                                                 
  1243. Host=+                                                                          
  1244. End                                                                             
  1245.                                                                                 
  1246. Type=FILE                                                                       
  1247. Name=REXX Exec Interface                                                        
  1248. Path=(ABOUTCSX)                                                                 
  1249. Host=+                                                                          
  1250. End                                                                             
  1251.                                                                                 
  1252. ./   ADD NAME=ABOUTCSC,SSI=01010046                                             
  1253.                                                                                 
  1254. =======================================================================         
  1255.                                                                                 
  1256.  Customizing Your Gopher Startup                                                
  1257.                                                                                 
  1258. =======================================================================         
  1259.                                                                                 
  1260.  When you use the GOPHER client, information about your use of GOPHER           
  1261.  is stored in a data set called GOPHERRC.  If you don't have one,               
  1262.  GOPHER will create it for you.                                                 
  1263.                                                                                 
  1264.  Your default startup menu will contain a single item pointing to a             
  1265.  GOPHER server on MVS, whether such a server is available or not.               
  1266.  However, you can ask GOPHER to display a different startup menu for            
  1267.  you.  This startup menu may have entries for the GOPHER server                 
  1268.  on MVS and one for your own private (local) data, which is accessed            
  1269.  without querying a server.                                                     
  1270.                                                                                 
  1271.  To get GOPHER to set up a different startup menu, you must edit the            
  1272.  GOPHERRC file.  Note that you may set up the GOPHER startup menu to            
  1273.  include a pointer to your local data - but you have to create that             
  1274.  local data in order to use it.                                                 
  1275.                                                                                 
  1276.  Editing the GOPHERRC file should be easy.  Just follow the                     
  1277.  instructions in the comments of the file itself.  For information              
  1278.  about the contents of GOPHERRC, see the HELP for operand GOPHERRC.             
  1279.                                                                                 
  1280. ./   ADD NAME=ABOUTCSL,SSI=01000056                                             
  1281.                                                                                 
  1282. =======================================================================         
  1283.                                                                                 
  1284.  Requesting Local (Serverless) Access                                           
  1285.                                                                                 
  1286. =======================================================================         
  1287.                                                                                 
  1288.  The LOCAL operand on the GOPHER command is a convenient way of                 
  1289.  requesting "local" serverless mode.  Specify LOCAL on the GOPHER               
  1290.  command if you want to enter GOPHER in "serverless" mode - i.e.                
  1291.  start up with your private GOPHER menu.  Specifying LOCAL                      
  1292.  accomplishes two things:                                                       
  1293.                                                                                 
  1294.   (1) It sets the server to "-", meaning local access.  Therefore, you          
  1295.       must also provide a path, either via the PATH operand on the              
  1296.       GOPHER command or via a "localmenu:" spec in your GOPHERRC file,          
  1297.       so that GOPHER knows where to look for your private data.  The            
  1298.       path is a data set name, FULLY QUALIFIED WITHOUT QUOTES.                  
  1299.                                                                                 
  1300.   (2) It allows you to use GOPHER even if there are other TCP/IP socket         
  1301.       applications active elsewhere in your TSO session.  However, it           
  1302.       will not allow you to connect to any GOPHER servers, even if you          
  1303.       have a local menu item that points to one.                                
  1304.                                                                                 
  1305.  If you do not specify a server and there is no specification in                
  1306.  your GOPHERRC file for one, then GOPHER will display a startup                 
  1307.  ISPF panel asking you to specify a server name and, optionally,                
  1308.  a path name.  (Don't touch the port number!)                                   
  1309. ./   ADD NAME=ABOUTCSM,SSI=01030019                                             
  1310.                                                                                 
  1311. =======================================================================         
  1312.                                                                                 
  1313.  Defining Gopher Menus                                                          
  1314.                                                                                 
  1315. =======================================================================         
  1316.                                                                                 
  1317.  This is a description of how to define GOPHER menus that can be used           
  1318.  either for your own private data or by the GOPHER server administrator         
  1319.  on MVS to define publicly accessible data.                                     
  1320.                                                                                 
  1321.  Bear in mind that the menu may be used to specify data meaningful to           
  1322.  a server other than MVS.  Therefore, the descriptions here should be           
  1323.  interpreted in two ways:                                                       
  1324.                                                                                 
  1325.  (1) how to define MVS-resident information resources                           
  1326.                                                                                 
  1327.  (2) how to request information resources from other GOPHER servers             
  1328.                                                                                 
  1329. ------------------------------------------------------------------------        
  1330.                                                                                 
  1331.  How To Define MVS-Resident Information Resources                               
  1332.                                                                                 
  1333.  The Gopher server (and the Gopher client, in "local" mode) determines          
  1334.  how to return information to the client via menus.  These menus are            
  1335.  plain MVS data sets with a particular structure.                               
  1336.                                                                                 
  1337.  An MVS gopher menu is a sequential data set or PDS member with the             
  1338.  following format:                                                              
  1339.                                                                                 
  1340.  * the first line contains the string GOPHER_MENU                               
  1341.    (in upper, lower or mixed case)                                              
  1342.                                                                                 
  1343.  * the rest of the file contains blocks of information like this:               
  1344.                                                                                 
  1345.    TYPE=type                                                                    
  1346.    NAME=name                                                                    
  1347.    PATH=path                                                                    
  1348.    HOST=host                                                                    
  1349.    PORT=port                                                                    
  1350.    END                                                                          
  1351.                                                                                 
  1352.    For compatibility with earlier versions of the MVS Gopher server,            
  1353.    the following are also accepted:                                             
  1354.                                                                                 
  1355.    DISPLAY=      is equivalent to NAME=                                         
  1356.    SELECTOR=     is equivalent to PATH=                                         
  1357.                                                                                 
  1358.    Explanations                                                                 
  1359.                                                                                 
  1360.    TYPE=type                                                                    
  1361.                                                                                 
  1362.    The type of Gopher entity (FILE, DIRECTORY, INDEX, etc.).                    
  1363.    In other words, one of the following:                                        
  1364.                                                                                 
  1365.    FILE      - the item is an MVS data set with text to be displayed.           
  1366.                The path name is the file name or a REXX exec spec.              
  1367.    DIRECTORY - the item is another Gopher directory.                            
  1368.                The path name is the file name or a REXX exec spec.              
  1369.    INDEX     - the item is a full text search item, which means that            
  1370.                the client will query the user for a search string               
  1371.                which will be passed to the server along with the                
  1372.                pathname.  For the MVS server.  it only makes sense for          
  1373.                the pathname to be a REXX exec specification.  The path          
  1374.                and the user's string are given to the host, which               
  1375.                returns a menu of selections.  See also WHOIS.                   
  1376.    TELNET    - the item is a Telnet server.                                     
  1377.                The path name is ignored.  The port number should be             
  1378.                omitted or set to 0, unless an alternate TELNET port             
  1379.                is required by the server referenced by HOST.                    
  1380.    WHOIS     - the item is a "whois" query.  This is similar to the             
  1381.                INDEX type, except that the server returns a file                
  1382.                rather than a menu.  This is not (yet) an official               
  1383.                part of the Gopher protocol, though it does appear in            
  1384.                certain (patched) versions of other implementations.             
  1385.                                                                                 
  1386.    NAME=name                                                                    
  1387.                                                                                 
  1388.    The descriptive string that will appear in the Gopher client's               
  1389.    display of menu selections for this item.  Make this as human as             
  1390.    possible.  Case is preserved.                                                
  1391.                                                                                 
  1392.    PATH=path                                                                    
  1393.                                                                                 
  1394.    The pathname to be passed to the Gopher server to retrieve the               
  1395.    item.  See below for a fuller description.                                   
  1396.                                                                                 
  1397.    HOST=host                                                                    
  1398.                                                                                 
  1399.    The name of the Gopher server host that will process the request.            
  1400.    See below for a fuller description.                                          
  1401.                                                                                 
  1402.    PORT=port                                                                    
  1403.                                                                                 
  1404.    The TCP/IP port to connect to.  For Gopher, this should always be            
  1405.    port 70 (except for a TELNET type, whose port defaults to the                
  1406.    standard TELNET port if zero or omitted).  If this is omitted, then          
  1407.    the default port number is taken.                                            
  1408.                                                                                 
  1409.    END                                                                          
  1410.                                                                                 
  1411.    Required to keep menu entries separate.                                      
  1412.                                                                                 
  1413.  Comment lines may be freely included, starting with '#' in                     
  1414.  the first column of data.                                                      
  1415.                                                                                 
  1416. More about Path Names                                                           
  1417.                                                                                 
  1418.  Note that the format of a path depends on which Gopher server is               
  1419.  going to be processing the entry, as defined by the HOST= field.               
  1420.  If the entry is going to a different Gopher server, then the                   
  1421.  pathname format depends on that server.  For example, a Unix server            
  1422.  would expect a Unix file name with a slash.                                    
  1423.                                                                                 
  1424.  A path name for the MVS Gopher may be one of the following:                    
  1425.                                                                                 
  1426.  * A fully qualified MVS data set name, without quotes, identifying             
  1427.    a sequential text data set or PDS member.  If TYPE=FILE, this is             
  1428.    text.  If TYPE=DIRECTORY, this is a gopher menu as described above.          
  1429.                                                                                 
  1430.  * A fully qualified MVS data set name, without quotes, identifying a           
  1431.    PDS (no member).  This causes the MVS Gopher server to return a              
  1432.    list of member names of the PDS in Gopher directory format.  This            
  1433.    is valid only with TYPE=DIRECTORY.  Member aliases are included in           
  1434.    the resulting list.                                                          
  1435.                                                                                 
  1436.  * A member name enclosed in parentheses.  This is treated as                   
  1437.    a full PDS member.  In other words, the MVS Gopher server will use           
  1438.    the name of the PDS in which the menu itself was found.                      
  1439.    This allows you to move PDS's full of Gopher menus around without            
  1440.    having to worry about changing all the path names.  This happens             
  1441.    only when the menu itself is a PDS member and the host is the                
  1442.    same as the local host (MVS for the server, - for local mode).               
  1443.    Specifying HOST=+ is recommended for this.                                   
  1444.                                                                                 
  1445.  * A string "DD:ddname" or "DD:ddname(member)", identifying a file by           
  1446.    MVS ddname a la C/370.  Valid with either TYPE=FILE or                       
  1447.    TYPE=DIRECTORY, so the ddname can point to text or a menu.                   
  1448.    However, if the ddname happens to be allocated to a PDS, it does             
  1449.    NOT work like a directory above - it's just illegal and will                 
  1450.    probably cause lossage.                                                      
  1451.                                                                                 
  1452.    Each member is treated as a Gopher FILE.  The NAME field is                  
  1453.    set to the member name.  If you want to do anything fancier                  
  1454.    than this, you will have to construct your own Gopher menu.                  
  1455.                                                                                 
  1456.  * A string "EXEC:execname args", which specifies the name of a                 
  1457.    REXX exec to be executed to return the data.  Valid with any                 
  1458.    and all types.  To learn more about how to make use of this                  
  1459.    feature, please go back to the "About This Gopher" tree and                  
  1460.    read up on using REXX execs with MVS Gopher.                                 
  1461.                                                                                 
  1462.    If you are using your own private GOPHER data via local access               
  1463.    and you want to run REXX execs, you must have a "localexec:"                 
  1464.    line in your GOPHERRC file identifying your REXX exec library.               
  1465.                                                                                 
  1466. More About Host Names                                                           
  1467.                                                                                 
  1468.  You may find that some Gopher servers insist on appending the                  
  1469.  network's domain name to local server hostnames.  You should check             
  1470.  with your network gurus to make sure that this will work with your             
  1471.  TCP/IP host lookup.  The MVS server will accept hostnames either               
  1472.  with or without the domain name appended - this applies to the                 
  1473.  specification of hostnames in the Gopher access table as well -                
  1474.  but other Gopher servers may not.                                              
  1475.                                                                                 
  1476. Two special cases:                                                              
  1477.                                                                                 
  1478.  A plus sign (HOST=+) means that the host is the same host as the one           
  1479.  that is looking at the directory entry - i.e. the server that is               
  1480.  serving up this menu.  The Gopher server simply plugs in its own host          
  1481.  name at that point.  This is NOT part of the Gopher protocol, but              
  1482.  merely a server hack.                                                          
  1483.                                                                                 
  1484.  A minus sign (HOST=-) means that access to this item will be in                
  1485.  "local" (serverless) mode.  This is recognized only by the MVS Gopher          
  1486.  client.  It means that the client will do the retrieval itself,                
  1487.  without asking a server to do it.                                              
  1488.                                                                                 
  1489.  The directory-processing code, when invoked in "local mode", will              
  1490.  treat HOST=+ as HOST=- since the current host is the local mode                
  1491.  operation in that case.  Therefore, using HOST=+ is recommended                
  1492.  so that one can port one's local GOPHER menus to the public server             
  1493.  at some point.                                                                 
  1494.                                                                                 
  1495.  A REXX exec that generates menus dynamically can use - as a hostname,          
  1496.  but not +.                                                                     
  1497.                                                                                 
  1498. ------------------------------------------------------------------------        
  1499.                                                                                 
  1500.  How To Request Information Resources From Other GOPHER Servers                 
  1501.                                                                                 
  1502. Rather than describe the standard format of a Gopher menu here,                 
  1503. I recommend that you go to your nearest Unix box and type                       
  1504.                                                                                 
  1505.   man gopherd                                                                   
  1506.                                                                                 
  1507. That should tell you all you need to know about Unix gopher servers.            
  1508. If your gopher server is on some other kind of machine, then go find            
  1509. the documentation for that machine's Gopher menus.                              
  1510.                                                                                 
  1511. The purpose of the above exercise is primarily to determine the format          
  1512. of a path name understood by a given Gopher server.  Once you know that,        
  1513. you can build a Gopher menu the MVS Gopher will understand, according to        
  1514. the format described in the top section.  Set the host to point to              
  1515. the other Gopher server, who will interpret the other items in the menu.        
  1516.                                                                                 
  1517. ------------------------------------------------------------------------        
  1518.                                                                                 
  1519. Dynamic Generation of GOPHER Menus                                              
  1520.                                                                                 
  1521.  If you want to be able to generate a Gopher menu dynamically,                  
  1522.  you can do this via the REXX interface.  You also must understand              
  1523.  the Gopher protocol.  A Gopher menu is really a text representation            
  1524.  of the actual protocol, which goes like this:                                  
  1525.                                                                                 
  1526.  filetype -tab- name -tab- path -tab- host -tab- port                           
  1527.                                                                                 
  1528.  where -tab- is the EBCDIC (on MVS) or ASCII (on other box) tab                 
  1529.  character, and filetype is a single character.  The filetypes                  
  1530.  supported by the MVS Gopher server are:                                        
  1531.                                                                                 
  1532.  0 - flat file                                                                  
  1533.  1 - directory                                                                  
  1534.  2 - error                                                                      
  1535.  7 - index                                                                      
  1536.  8 - TELNET                                                                     
  1537.  w - whois (experimental)                                                       
  1538.                                                                                 
  1539.  A REXX exec that wants to generate a Gopher menu must output lines             
  1540.  in this format.  For more information, go back to the Gopher tree              
  1541.  for "About This Gopher" and look up information on the REXX interface.         
  1542.                                                                                 
  1543. ./   ADD NAME=ABOUTCSR,SSI=01010039                                             
  1544.                                                                                 
  1545. =======================================================================         
  1546.                                                                                 
  1547.  The GOPHERRC File                                                              
  1548.                                                                                 
  1549. =======================================================================         
  1550.                                                                                 
  1551.  When you use the GOPHER client, you need a file called GOPHERRC                
  1552.  which stores information about your use of GOPHER.  If you don't               
  1553.  have one, GOPHER will create it for you.  The file initially                   
  1554.  contains:                                                                      
  1555.                                                                                 
  1556.     the initial path/name/host/port specification, which tells                  
  1557.     GOPHER what to display on startup.  By default this is the                  
  1558.     standard GOPHER server info on MVS.  However, you can add                   
  1559.     to your GOPHERRC a specification for local GOPHER by                        
  1560.     editing GOPHERRC and activating one of the following:                       
  1561.                                                                                 
  1562.     - the other "initial:" spec which points to your own startup menu,          
  1563.       overriding the one you'd get otherwise                                    
  1564.                                                                                 
  1565.     - the localmenu: and localexec: lines.                                      
  1566.                                                                                 
  1567.     localmenu: is equivalent to specifying an alternate initial:                
  1568.     spec of host=- (dash) and path=localmenu_name.  When you use                
  1569.     the LOCAL operand of the GOPHER command, localmenu: is what                 
  1570.     GOPHER looks for as the pathname if you don't provide one on                
  1571.     the command.                                                                
  1572.                                                                                 
  1573.     localexec: is required if you want to use your own library of               
  1574.     GOPHER rexx execs.  This is valid for LOCAL access only.                    
  1575.                                                                                 
  1576.     Some option defaults are stored in the GOPHERRC file.                       
  1577.     Note that this is not yet implemented.                                      
  1578.                                                                                 
  1579.     The GOPHER client will store bookmarks (as you create them)                 
  1580.     at the end of your GOPHERRC file.  Note that this feature                   
  1581.     is not yet implemented.                                                     
  1582.                                                                                 
  1583.     If you have a newly created GOPHERRC file, you can read the                 
  1584.     comments to guide you in customizing the file.                              
  1585. ./   ADD NAME=ABOUTCSW,SSI=01000034                                             
  1586.                                                                                 
  1587. =======================================================================         
  1588.                                                                                 
  1589.  What Happens When You Start Up GOPHER?                                         
  1590.                                                                                 
  1591. =======================================================================         
  1592.                                                                                 
  1593.  What you see when you start up GOPHER depends on what you have                 
  1594.  specified, either on the command line or in the GOPHERRC file.                 
  1595.  In general, command operands override GOPHERRC specifications.                 
  1596.                                                                                 
  1597.  GOPHER does its thing by connecting to a Gopher server somewhere               
  1598.  on your network.  If you do not specify otherwise, this server is              
  1599.  assumed to be MVS (the host where you are running this client).                
  1600.  The default GOPHERRC file specifies this as the server.                        
  1601.  The startup menu you see is the one defined by the administrator               
  1602.  of that server.                                                                
  1603.                                                                                 
  1604.  You can request a different server or a different startup menu,                
  1605.  either by modifying the GOPHERRC file or by specifying command                 
  1606.  operands.  The SERVER operand tells GOPHER to get a startup menu               
  1607.  from a different server, and the PATH operand tells GOPHER what                
  1608.  startup menu to request (the contents of the path depend on what               
  1609.  server you point to and what it's looking for, but it is typically             
  1610.  the name of a file on that system that contains a Gopher menu).                
  1611.                                                                                 
  1612.  You can also use GOPHER to access your own private data by requesting          
  1613.  "local" (serverless) mode.  A server name of a single dash "-" means           
  1614.  local access.  In this case, you must provide a path name so that              
  1615.  GOPHER knows where to look for your data.  The path name is the name           
  1616.  of a data set containing your GOPHER menu - it must be FULLY QUALIFIED         
  1617.  AND WITHOUT QUOTES.  The path name can be provided either as a command         
  1618.  operand or in the GOPHERRC file.                                               
  1619. ./   ADD NAME=ABOUTCSX,SSI=01020059                                             
  1620. =======================================================================         
  1621.                                                                                 
  1622. REXX Exec Interface                                                             
  1623.                                                                                 
  1624. =======================================================================         
  1625.                                                                                 
  1626. You can request the MVS Gopher server (or the MVS Gopher client, in             
  1627. "local" (serverless) mode) to retrieve information dynamically by               
  1628. executing a REXX exec.  To request this, you define a menu entry                
  1629. with the following PATH= field:                                                 
  1630.                                                                                 
  1631. PATH=EXEC:execname args                                                         
  1632.                                                                                 
  1633. In the case of EXEC:, the REXX exec identified by "execname" is                 
  1634. executed, along with the arguments "args" given.  For example:                  
  1635.                                                                                 
  1636. PATH=EXEC:MYEXEC ANY ARGS                                                       
  1637.                                                                                 
  1638. will cause the MYEXEC exec to be executed with "ANY ARGS" as the                
  1639. single argument string.                                                         
  1640.                                                                                 
  1641. If the TYPE is INDEX, the search string submitted by the user will be           
  1642. appended to the args separated by a blank.  The exec must be able to            
  1643. deal with this.                                                                 
  1644.                                                                                 
  1645. REXX Execs must be in a PDS allocated to DD GGEXEC.  This ddname                
  1646. needs to be allocated in the Gopher server's JCL.  For local mode,              
  1647. the GOPHER command will allocate the GGEXEC file to the REXX exec               
  1648. library specified on the "localexec:" line in your GOPHERRC file,               
  1649. if you have activated it.  Otherwise you will not be able to use                
  1650. REXX execs in local mode.                                                       
  1651.                                                                                 
  1652. Note that you do not need the /* REXX */ comment at the beginning of            
  1653. REXX execs used by gopher (though it does not hurt to include it!)              
  1654. because they are invoked by the IRXEXEC facility and not the standard           
  1655. TSO CLIST/EXEC search.                                                          
  1656.                                                                                 
  1657. Now, how does the REXX exec return data to the Gopher server?                   
  1658.                                                                                 
  1659. First of all, it depends on the TYPE that the exec is expected                  
  1660. to return, which has nothing to do with HOW the returning is done.              
  1661.                                                                                 
  1662. So, first let's talk about how the exec returns data, and then                  
  1663. about what it is expected to return.                                            
  1664.                                                                                 
  1665. How to return data                                                              
  1666.                                                                                 
  1667. The REXX exec must return data by writing it to the SYSTSPRT DD.                
  1668. Note that this is where normal TSO output goes when a REXX exec                 
  1669. is run in TSO batch.  However, since REXX execs are invoked by                  
  1670. the IRXEXEC interface by the Gopher server, to prevent dependency               
  1671. on a TSO environment, this default behavior of REXX/TSO cannot                  
  1672. be relied upon.  Therefore, if you write a REXX exec to return                  
  1673. Gopher data, you must explicitly send the output to the SYSTSPRT                
  1674. ddname.  The Gopher server makes sure that it can read this data.               
  1675.                                                                                 
  1676. A typical approach is to queue all the output to the REXX data stack,           
  1677. queue a final "" and then use EXECIO.  Be careful not to queue null             
  1678. lines in this case.  Be sure to protect the stack in case of lossage.           
  1679. Example:                                                                        
  1680.                                                                                 
  1681.  "NEWSTACK"                                                                     
  1682.  do while more_data_to_get                                                      
  1683.   some_data = get_some_data()                                                   
  1684.   if some_data = "" then queue " "                                              
  1685.   else queue some_data                                                          
  1686.  end                                                                            
  1687.  queue ""                                                                       
  1688.  "EXECIO * DISKW SYSTSPRT (FINIS)"                                              
  1689.  "DELSTACK"                                                                     
  1690.                                                                                 
  1691. You can also create a stem variable to hold the output, if you                  
  1692. want to avoid problems with null lines or nested stacks.  Example:              
  1693.                                                                                 
  1694.  do i = 1 to whatever                                                           
  1695.    foo.i = get_some_data()                                                      
  1696.  end                                                                            
  1697.  foo.0 = i                                                                      
  1698.  "EXECIO * DISKW SYSTSPRT (FINIS STEM FOO.)"                                    
  1699.                                                                                 
  1700. A downside is that if the REXX exec finds anomalous conditions                  
  1701. or executes a TSO command that barfs, standard TSO command output               
  1702. will probably get lost.  Therefore, try to use OUTTRAP to capture               
  1703. command output and test for error codes, and write all captured                 
  1704. output or error messages to SYSTSPRT in such a way as to allow                  
  1705. the client to see them (but not treat them as normal directory                  
  1706. data or whatever).                                                              
  1707.                                                                                 
  1708. A helpful hack is to use an EXECUTE exec to invoke other REXX                   
  1709. code or TSO commands that normally output via PUTLINE.  e.g.:                   
  1710.                                                                                 
  1711. /* REXX. Usage: EXECUTE exec args... */                                         
  1712.                                                                                 
  1713.  parse arg real_exec_command                                                    
  1714.  parse source sourceline                                                        
  1715.  if word(sourceline,7) = "TSO" then do                                          
  1716.   x = outtrap("LINE.")                                                          
  1717.   real_exec_command                                                             
  1718.   arc = rc                                                                      
  1719.   x = outtrap("OFF")                                                            
  1720.   "EXECIO * DISKW SYSTSPRT (FINIS STEM LINE.)"                                  
  1721.  end                                                                            
  1722.  else do                                                                        
  1723.   real_exec_command                                                             
  1724.   arc = rc                                                                      
  1725.  end                                                                            
  1726.                                                                                 
  1727.  return arc                                                                     
  1728.                                                                                 
  1729. I don't recommend this, though, because it's SLOW.                              
  1730.                                                                                 
  1731.                                                                                 
  1732. If the Gopher server is a TSO-in-batch job (i.e. EXEC PGM=IKJEFT01)             
  1733. then you can issue TSO commands from the exec.  To get the output,              
  1734. though, you need to use OUTTRAP around them.  If they issue TPUT's,             
  1735. you are SOL.  If they are PL/1 programs that write to SYSPRINT, or              
  1736. FORTRAN or assembler, etc., allocate the SYSPRINT or FT06F001 or                
  1737. whatever file to a temporary and copy the temporary to SYSTSPRT.  If            
  1738. it is a C/370 program that writes to stdout or stderr, you may be able          
  1739. to use redirection:                                                             
  1740.                                                                                 
  1741.    CALL 'THEIR.LOAD(CPROG)' 'args > DD:SYSTSPRT'                                
  1742.                                                                                 
  1743.  for stdout                                                                     
  1744.                                                                                 
  1745.    CALL 'THEIR.LOAD(CPROG)' 'args 2> DD:SYSTSPRT'                               
  1746.                                                                                 
  1747.  for stderr                                                                     
  1748.                                                                                 
  1749.  (for multiple output, use >> instead of >)                                     
  1750.                                                                                 
  1751.  If gopher server is run straight batch rather than as a TSO job, then          
  1752.  you cannot run REXX execs that require a TSO environment.                      
  1753.                                                                                 
  1754.  One more important word:  Make sure that your SYSTSPRT file has a              
  1755.  large enough LRECL to handle the REXX output.  If it is too short,             
  1756.  the REXX output will get folded.  For TYPE=DIRECTORY in particular,            
  1757.  this is disastrous.  Recommended JCL for executing the Gopher server           
  1758.  may be found elsewhere in the installation materials, or your MVS              
  1759.  system programmer has probably already installed a Gopher server in            
  1760.  'SYS1.PROCLIB' or the equivalent with the correct allocation.                  
  1761.                                                                                 
  1762. What it is expected to return                                                   
  1763.                                                                                 
  1764.  OK - now the good stuff.  This depends on the TYPE on the menu entry           
  1765.  that your exec is trying to fulfill.  Some gopher protocol basics:             
  1766.                                                                                 
  1767.  A Gopher menu is really a text representation of the actual protocol,          
  1768.  which goes like this:                                                          
  1769.                                                                                 
  1770.  filetype -tab- name -tab- path -tab- host -tab- port                           
  1771.                                                                                 
  1772.  where -tab- is the EBCDIC (on MVS) or ASCII (on other box) tab                 
  1773.  character, and filetype is a single character.  The filetypes                  
  1774.  supported by the MVS Gopher server are:                                        
  1775.                                                                                 
  1776.  0 - flat file                                                                  
  1777.  1 - directory                                                                  
  1778.  2 - error                                                                      
  1779.  7 - index                                                                      
  1780.  8 - TELNET                                                                     
  1781.  w - whois (experimental)                                                       
  1782.                                                                                 
  1783.  To generate the equivalent of a Gopher menu, you must output data              
  1784.  in the above format.  Now for the details...                                   
  1785.                                                                                 
  1786. TYPE=FILE                                                                       
  1787.                                                                                 
  1788. Just return the straight data.  Try to avoid null lines because C/370           
  1789. believes they don't exist and will throw them away.  We hate this, but          
  1790. IBM is so hard to convince of reality sometimes...  Change all null             
  1791. lines to lines containing one blank as you write them out (you need to          
  1792. do this anyway if you are queueing output on the stack for EXECIO) and          
  1793. you will have no problems.                                                      
  1794.                                                                                 
  1795. TYPE=DIRECTORY                                                                  
  1796.                                                                                 
  1797. You must return lines that fit the gopher protocol format as above.             
  1798.                                                                                 
  1799. For example, if you want to generate a Gopher menu on the fly that              
  1800. is equivalent to this:                                                          
  1801.                                                                                 
  1802. type=file                                                                       
  1803. name=This is my description                                                     
  1804. path=some.gopher.path                                                           
  1805. host=sun1.sanjuan.com                                                           
  1806. port=70                                                                         
  1807.                                                                                 
  1808. then you output a line that looks like this:                                    
  1809.                                                                                 
  1810.   0This is my description!some.gopher.path!sun1.sanjuan.com!70                  
  1811.                                                                                 
  1812. (each ! is really a tab (EBCDIC hex 05) character)                              
  1813.                                                                                 
  1814. where "0" is the type (file in this example, but would be "1" for               
  1815. type=directory, "7" for typeindex, etc.)                                        
  1816.                                                                                 
  1817. Here's the REXX code that might do this:                                        
  1818.                                                                                 
  1819. name = "This is my description"                                                 
  1820. path = "some.gopher.path"                                                       
  1821. host = "sun1.sanjuan.com"                                                       
  1822. tab  = '05'x                                                                    
  1823. port = 70                                                                       
  1824.                                                                                 
  1825. queue "0"||name||tab||path||tab||host||tab||port                                
  1826.                                                                                 
  1827. Assuming we write the queued lines to DD SYSTSPRT, as described.                
  1828.                                                                                 
  1829. Specifying the Right Host Name                                                  
  1830.                                                                                 
  1831. Most of the time you will probably want to generate a menu item                 
  1832. that points back to your MVS host, not some other host.  It may                 
  1833. even redrive your selfsame REXX exec with new arguments.  And if                
  1834. the exec was invoked in local (serverless) mode, you want the item              
  1835. to get driven in the same mode, probably.                                       
  1836.                                                                                 
  1837. The question is - what's the easiest way to identify what                       
  1838. the "same server" is?  One way is to hardcode the server name (e.g.             
  1839. "MVS.DRAPER.COM"), but this is not sufficiently general because:                
  1840.                                                                                 
  1841. (1) the server name or location may change                                      
  1842. (2) you can't distribute the exec to other Gopher users                         
  1843. (3) it won't work the same way in "local mode"                                  
  1844.                                                                                 
  1845. So, you need a way to know what the name of your selfsame host is.              
  1846. The MVS Gopher server can use HOST=+, but you can't, as that isn't              
  1847. part of the Gopher protocol.  So what do you do?                                
  1848.                                                                                 
  1849. Recommendation:  call a function hostname() to return the current               
  1850. host name.  So in the above code segment, you might have:                       
  1851.                                                                                 
  1852.  host = hostname()                                                              
  1853.                                                                                 
  1854. What is that hostname() function anyway?                                        
  1855. Well, you create it.                                                            
  1856. Take your Gopher exec library (please) and include an exec                      
  1857. called HOSTNAME, which you set up to return the name                            
  1858. of the host that you want to be the "same host".                                
  1859.                                                                                 
  1860. Note that a plus sign "+" will not work in this context.                        
  1861. The plus sign is a hack interpreted by the Gopher server                        
  1862. when it sees it on a menu.  It is *not* part of the Gopher                      
  1863. protocol and therefore cannot be sent over.                                     
  1864.                                                                                 
  1865. However, the minus sign "-" will work, as the Gopher client                     
  1866. in local mode will interpret it at the protocol level                           
  1867. (which DOES NOT IMPLY THAT IT IS A PART OF THE STANDARD                         
  1868. GOPHER PROTOCOL, PROPOSED OR OTHERWISE - THIS IS JUST A                         
  1869. LOCAL HACK MODIFICATION).                                                       
  1870.                                                                                 
  1871. Anyhow, what you ought to do is to have different Gopher                        
  1872. exec libraries for local (i.e.private) use and public                           
  1873. server use.  The public server will have a HOSTNAME member                      
  1874. that says                                                                       
  1875.                                                                                 
  1876.  return "MVS.DRAPER.COM"                                                        
  1877.                                                                                 
  1878. or whatever the name of *YOUR* gopher server host is.                           
  1879.                                                                                 
  1880. Your private exec library should have a HOSTNAME member                         
  1881. that says                                                                       
  1882.                                                                                 
  1883.   return "-"                                                                    
  1884.                                                                                 
  1885. This is the best I can come up with right now.  A future enhancement            
  1886. may be to pass the hostname as the second arg to the REXX exec using            
  1887. the IRXEXEC interface, e.g.                                                     
  1888.                                                                                 
  1889. parse arg execargs, hostname                                                    
  1890.                                                                                 
  1891. Then we could pass even more such arguments, like port, etc.                    
  1892. But that's all for now...                                                       
  1893.                                                                                 
  1894.                                                                                 
  1895. ./   ADD NAME=ABOUTCX,SSI=01000051                                              
  1896. This text has not been written yet.                                             
  1897. ./   ADD NAME=ABOUTS,SSI=01040038                                               
  1898. gopher_menu                                                                     
  1899.                                                                                 
  1900. TYPE=FILE                                                                       
  1901. NAME=Creating MVS Gopher Menus                                                  
  1902. PATH=(ABOUTCSM)                                                                 
  1903. HOST=+                                                                          
  1904. END                                                                             
  1905.                                                                                 
  1906. TYPE=FILE                                                                       
  1907. NAME=MVS Gopher Access Table                                                    
  1908. PATH=(ABOUTSA)                                                                  
  1909. HOST=+                                                                          
  1910. END                                                                             
  1911.                                                                                 
  1912. TYPE=FILE                                                                       
  1913. NAME=REXX Exec Interface                                                        
  1914. PATH=(ABOUTCSX)                                                                 
  1915. HOST=+                                                                          
  1916. END                                                                             
  1917.                                                                                 
  1918. ./   ADD NAME=ABOUTSA,SSI=01020004                                              
  1919.                                                                                 
  1920.   Format of entries in the Gopher Access Table:                                 
  1921.                                                                                 
  1922.   filename (fully qualified, all uppercase, no quotes)                          
  1923.   can be "DD:DDNAME" or "EXEC:EXECNAME"                                         
  1924.                                                                                 
  1925.   followed by names of hosts which are authorized to access the data.           
  1926.   If no host name list is present, all hosts are authorized                     
  1927.                                                                                 
  1928.   You may specify the same file name more than once, if you need                
  1929.   more lines to put host names on.                                              
  1930.                                                                                 
  1931.   Individual PDS members must be specified separately.  A PDS without           
  1932.   a member name establishes access only to the PDS directory.                   
  1933.                                                                                 
  1934.   Note that the default directory MUST be in this table.                        
  1935.                                                                                 
  1936.   Also note that in the case of EXECs, the EXEC must live in the                
  1937.   library allocated to GGEXEC in the Gopher server JCL.                         
  1938.                                                                                 
  1939.   *** ANY DATA SET REFERENCED BY ANY EXEC IN THAT LIBRARY IS FULLY              
  1940.   *** ACCESSIBLE TO GOPHER REGARDLESS OF THIS TABLE!  USE THIS TABLE            
  1941.   *** TO GOVERN CONTROL TO THE EXEC ITSELF!!!                                   
  1942.                                                                                 
  1943. ./   ADD NAME=ABOUTW,SSI=01020053                                               
  1944. What is Gopher?                                                                 
  1945.                                                                                 
  1946. For more information, read the FAQ, posted to USENET newsgroups                 
  1947. comp.infosystems.gopher and news.answers every two weeks.                       
  1948.                                                                                 
  1949. The information contained here is borrowed therefrom in large part.             
  1950.                                                                                 
  1951. Gopher is a client/server protocol for building a distributed                   
  1952. information delivery service.  While providing a delivery vehicle for           
  1953. local information, Gopher also facilitates access to other Gopher and           
  1954. information servers on the Internet.                                            
  1955.                                                                                 
  1956. Gopher servers and clients can be obtained via anonymous ftp to                 
  1957. boombox.micro.umn.edu.  Look in the directory /pub/gopher.                      
  1958.                                                                                 
  1959.      There are clients for the following systems.  For the latest               
  1960.      directory information, see the FAQ.                                        
  1961.                                                                                 
  1962.       Unix Curses & Emacs                                                       
  1963.       Xwindows                                                                  
  1964.       Macintosh Hypercard                                                       
  1965.       Macintosh Application                                                     
  1966.       DOS w/Clarkson Driver                                                     
  1967.       NeXTstep                                                                  
  1968.       VM/CMS                                                                    
  1969.       VMS                                                                       
  1970.       MVS                                                                       
  1971.                                                                                 
  1972.      There are also a number of public telnet login sites available.            
  1973.      See the FAQ for more information.                                          
  1974.                                                                                 
  1975.      There are servers for the following systems.  For the latest               
  1976.      directory information, see the FAQ.                                        
  1977.                                                                                 
  1978.        Unix                                                                     
  1979.        VMS                                                                      
  1980.        Macintosh                                                                
  1981.        VM/CMS                                                                   
  1982.        MVS                                                                      
  1983.                                                                                 
  1984.                                                                                 
  1985. Papers and articles describing Gopher:                                          
  1986.                                                                                 
  1987.      _The_Internet_Gopher_, "ConneXions", July 1992, Interop.                   
  1988.                                                                                 
  1989.      _Exploring_Internet_GopherSpace_ "The Internet Society News", v1n2 1992,   
  1990.                                                                                 
  1991.      _The_Internet_Gopher_Protocol_, Proceedings of the Twenty-Third            
  1992.           IETF, CNRI, Section 5.3                                               
  1993.                                                                                 
  1994.      _Internet_Gopher_, Proceedings of Canadian Networking '92                  
  1995.                                                                                 
  1996.      _The_Internet_Gopher_, INTERNET: Getting Started, SRI                      
  1997.           International, Section 10.5.5                                         
  1998.                                                                                 
  1999.      _Tools_help_Internet_users_discover_on-line_treasures, Computerworld,      
  2000.           July 20, 1992                                                         
  2001.                                                                                 
  2002.      Gopher will also be in two forthcoming O'Reilly Books:                     
  2003.      "Administrating TCP/IP, and The Whole Internet"                            
  2004.                                                                                 
  2005. ./   ADD NAME=FAQ,SSI=01020044                                                  
  2006. Xref: news.draper.com comp.infosystems.gopher:886 news.answers:2444             
  2007. Newsgroups: comp.infosystems.gopher,news.answers                                
  2008. From: gopher@boombox.micro.umn.edu (UofMN Gopher Team)                          
  2009. Subject: Gopher (comp.infosystems.gopher) Frequently Asked Questions (FAQ)      
  2010. Followup-To: comp.infosystems.gopher                                            
  2011. Summary: Common Questions and Answers about the Internet Gopher, a              
  2012.         client/server protocol for making a world wide information              
  2013.         service, with many implementations.                                     
  2014. Sender: news@news2.cis.umn.edu (Usenet News Administration)                     
  2015. Organization: University of Minnesota                                           
  2016. Date: Thu, 5 Nov 1992 21:29:00 GMT                                              
  2017.                                                                                 
  2018. Archive-name: gopher-faq                                                        
  2019. Last-modified: 1992/10/29                                                       
  2020.                                                                                 
  2021. Common Questions and Answers about the Internet Gopher, a                       
  2022. client/server protocol for making a world wide information service,             
  2023. with many implementations.  Posted to comp.infosystems.gopher and               
  2024. news.answers every two weeks.                                                   
  2025.                                                                                 
  2026. The most recent version of this FAQ can be gotten through gopher, or            
  2027. via anonymous ftp:                                                              
  2028.                                                                                 
  2029. pit-manager.mit.edu:/pub/usenet/news.answers/gopher-faq                         
  2030.                                                                                 
  2031. Those without FTP access should send e-mail to mail-server@rtfm.mit.edu         
  2032. with "send usenet/news.answers/finding-sources" in the body to find out         
  2033. how to do FTP by e-mail.                                                        
  2034.                                                                                 
  2035.                                                                                 
  2036.                                                                                 
  2037. -------------------------------------------------------------------             
  2038. Q0:  What is Gopher?                                                            
  2039.                                                                                 
  2040. A0:  The Internet Gopher client/server provides a distributed                   
  2041.      information delivery system around which a world/campus-wide               
  2042.      information system (CWIS) can readily be constructed.   While              
  2043.      providing a delivery vehicle for local information,  Gopher                
  2044.      facilitates access to other Gopher and information servers                 
  2045.      throughout the world.                                                      
  2046.                                                                                 
  2047. -------------------------------------------------------------------             
  2048. Q1:  Where can I get gopher?                                                    
  2049.                                                                                 
  2050. A1:  via anonymous ftp to boombox.micro.umn.edu.  Look in the directory         
  2051.      /pub/gopher                                                                
  2052.                                                                                 
  2053. --------------------------------------------------------------------            
  2054. Q2:  What do I need to access gopher?                                           
  2055.                                                                                 
  2056. A2:  You will need a gopher "client" program that runs on your local PC         
  2057.      or workstation                                                             
  2058.                                                                                 
  2059.      There are clients for the following systems.  The directory                
  2060.      following the name is the location of the client on the anonymous          
  2061.      ftp site boombox.micro.umn.edu (134.84.132.2) in the directory             
  2062.      /pub/gopher.                                                               
  2063.                                                                                 
  2064.       Unix Curses & Emacs   :  /pub/gopher/Unix/gopher1.03.tar.Z                
  2065.       Xwindows              :  /pub/gopher/Unix/xgopher1.1a.tar.Z               
  2066.       Macintosh Hypercard   :  /pub/gopher/Mac_client/                          
  2067.       Macintosh Application :  /pub/gopher/Macintosh-TurboGopher                
  2068.       DOS w/Clarkson Driver :  /pub/gopher/PC_client/                           
  2069.       NeXTstep              :  /pub/gopher/NeXT/                                
  2070.       VM/CMS                :  /pub/gopher/Rice_CMS/ or /pub/gopher/Vienna_CMS/ 
  2071.       VMS                   :  /pub/gopher/VMS/                                 
  2072.       OS/2 2.0              :  /pub/gopher/os2/                                 
  2073.       MVS/XA                :  /pub/gopher/mvs                                  
  2074.                                                                                 
  2075.      A Macintosh application, MacGopher is available via anonymous ftp          
  2076.      from ftp.cc.utah.edu:                                                      
  2077.                                                                                 
  2078.       Macintosh Application :  /pub/gopher/Macintosh                            
  2079.                                                                                 
  2080.      Another Macintosh application, "GopherApp" is available via                
  2081.      anonymous ftp from ftp.bio.indiana.edu:                                    
  2082.                                                                                 
  2083.       Macintosh Application :  /util/gopher/gopherapp                           
  2084.                                                                                 
  2085.      A port of the UNIX curses client for DOS with PC/TCP is available          
  2086.      via anonymous ftp from oac.hsc.uth.tmc.edu:                                
  2087.                                                                                 
  2088.       DOS w/ PC/TCP         :  /public/dos/misc/dosgofer.exe                    
  2089.                                                                                 
  2090.      A port of the UNIX curses client for PC-NFS is available via               
  2091.      anonymous ftp from bcm.tmc.edu:                                            
  2092.                                                                                 
  2093.       DOS w/ PC-NFS         : /nfs/gopher.exe                                   
  2094.                                                                                 
  2095.      A beta version of the PC Gopher client for Novell's LAN Workplace          
  2096.      for DOS is available from lennon.itn.med.umich.edu                         
  2097.                                                                                 
  2098.       LWP for DOS           :  /gopher                                          
  2099.                                                                                 
  2100.                                                                                 
  2101.      All of the above clients can also be fetched via a gopher client           
  2102.      itself.  Put the following on a gopher server:                             
  2103.                                                                                 
  2104.        Type=1                                                                   
  2105.        Host=boombox.micro.umn.edu                                               
  2106.        Port=70                                                                  
  2107.        Path=                                                                    
  2108.        Name=Gopher Software Distribution.                                       
  2109.                                                                                 
  2110.                                                                                 
  2111.      Or point your gopher client at boombox.micro.umn.edu, port 70 and          
  2112.      look in the gopher directory.                                              
  2113.                                                                                 
  2114.      There are also a number of public telnet login sites available.            
  2115.      The University of Minnesota operates one on the machine                    
  2116.      "consultant.micro.umn.edu" (134.84.132.4) See Q3 for more                  
  2117.      information about this.  It is recommended that you run the client         
  2118.      software instead of logging into the public telnet login sites.  A         
  2119.      client uses the custom features of the local machine (mouse,               
  2120.      scroll bars, etc.)  A local client is also faster.                         
  2121.                                                                                 
  2122. ---------------------------------------------------------------------           
  2123. Q3:  Where are there publicly available logins for gopher.                      
  2124.                                                                                 
  2125. A3:  Here is a short list, use the site closest to you to minimize              
  2126.      network lag.                                                               
  2127.                                                                                 
  2128.      Non-tn3270 Public Logins:                                                  
  2129.                                                                                 
  2130.      Hostname                  IP#              Login   Area                    
  2131.      ------------------------- ---------------  ------  -------------           
  2132.      consultant.micro.umn.edu  134.84.132.4     gopher  North America           
  2133.      gopher.uiuc.edu           128.174.33.160   gopher  North America           
  2134.      panda.uiowa.edu           128.255.40.201   panda   North America           
  2135.      gopher.sunet.se           192.36.125.2     gopher  Europe                  
  2136.      info.anu.edu.au           150.203.84.20    info    Australia               
  2137.      gopher.chalmers.se        129.16.221.40    gopher  Sweden                  
  2138.      tolten.puc.cl             146.155.1.16     gopher  South America           
  2139.      ecnet.ec                  157.100.45.2     gopher  Ecuador                 
  2140.                                                                                 
  2141.      tn3270 Public Logins:                                                      
  2142.                                                                                 
  2143.      Hostname                  IP#              Login   Area                    
  2144.      ------------------------- ---------------  ------  -------------           
  2145.      pubinfo.ais.umn.edu       128.101.109.1    -none-  North America           
  2146.                                                                                 
  2147.                                                                                 
  2148.      It is recommended that you run the client software instead of              
  2149.      logging into the public login sites.  A client uses the                    
  2150.      custom features of the local machine (mouse, scroll bars, etc.)            
  2151.      and is local client is also faster.                                        
  2152.                                                                                 
  2153. ---------------------------------------------------------------------           
  2154. Q4:  How can I add to the information in gopher?                                
  2155.                                                                                 
  2156. A4:  You can do this by running a gopher server.  Servers are available         
  2157.      for a number of systems.  Use anonymous ftp to                             
  2158.      boombox.micro.umn.edu (134.84.132.2) and look in /pub/gopher.  The         
  2159.      following servers are available there:                                     
  2160.                                                                                 
  2161.        Unix      : /pub/gopher/Unix/gopherxx.tar.Z                              
  2162.        VMS       : /pub/gopher/VMS/                                             
  2163.        Macintosh : /pub/gopher/Mac_server/                                      
  2164.        VM/CMS    : /pub/gopher/Rice_CMS/ or /pub/gopher/Vienna_CMS/             
  2165.        MVS       : /pub/gopher/mvs/                                             
  2166.        DOS PC    : /pub/gopher/PC_server/                                       
  2167.                                                                                 
  2168.                                                                                 
  2169.      When you have your server ready you can publish it to the world by         
  2170.      sending e-mail to the maintainters of the "Other gophers" list:            
  2171.                                                                                 
  2172.        gopher@boombox.micro.umn.edu                                             
  2173.                                                                                 
  2174. ---------------------------------------------------------------------           
  2175. Q5:  Who Develops Gopher Software?                                              
  2176.                                                                                 
  2177. A5:  Gopher was originally developed in April 1991 by the University            
  2178.      of Minnesota Microcomputer, Workstation, Networks Center to help           
  2179.      our campus find answers to their computer questions.                       
  2180.                                                                                 
  2181.      It has since grown into a full-fledged World Wide Information              
  2182.      System used by a large number of sites in the world.                       
  2183.                                                                                 
  2184.      Many people have contributed to the project, too numerous to               
  2185.      count.                                                                     
  2186.                                                                                 
  2187.      The people behind the much of the gopher software can be reached           
  2188.      via e-mail at gopher@boombox.micro.umn.edu, or via paper mail:             
  2189.                                                                                 
  2190.       Internet Gopher Developers                                                
  2191.       100 Union St. SE #190                                                     
  2192.       Minneapolis, MN 55455  USA                                                
  2193.                                                                                 
  2194. ---------------------------------------------------------------------           
  2195. Q6:  How can I set up a "CSO" phone book server?  Where is the software?        
  2196.                                                                                 
  2197. A6:  CSO phone book servers are also known as "qi" servers.  The                
  2198.      software implementation can be gotten via anonymous ftp from               
  2199.      uxc.cso.uiuc.edu (128.174.5.50) as /pub/qi.tar.Z.  You may also            
  2200.      see this referred to as "ph", which is what most of the clients            
  2201.      are called.                                                                
  2202.                                                                                 
  2203.      There is also an archive of the mailing list for qi/ph software on         
  2204.      the same machine.  It's in /pub/info-ph.archive.                           
  2205.                                                                                 
  2206.      This software is supported by Steve Dorner <s-dorner@uiuc.edu>             
  2207.      Contact him for more information.                                          
  2208.                                                                                 
  2209. -------------------------------------------------------------------             
  2210. Q7:  Why can't I access the University of Minnesota's UPI news?                 
  2211.                                                                                 
  2212. A7:  The University of Minnesota has a site license for UPI news, we            
  2213.      are not allowed to distribute it off of our campus.  We get our            
  2214.      UPI news from Clarinet.  For more information about getting UPI            
  2215.      news send mail to info@clarinet.com.  For information about                
  2216.      setting up your own gopher-UPI server search the gopher-news               
  2217.      archive for UPI.                                                           
  2218.                                                                                 
  2219. -------------------------------------------------------------------             
  2220. Q9:  What are the type characters for the different Gopher Objects?             
  2221.                                                                                 
  2222. A9:  Normal IDs.                                                                
  2223.                                                                                 
  2224.      0       Item is a file                                                     
  2225.      1       Item is a directory                                                
  2226.      2       Item is a CSO (qi) phone-book server                               
  2227.      3       Error                                                              
  2228.      4       Item is a BinHexed Macintosh file.                                 
  2229.      5       Item is DOS binary archive of some sort.                           
  2230.      6       Item is a UNIX uuencoded file.                                     
  2231.      7       Item is an Index-Search server.                                    
  2232.      8       Item points to a text-based telnet session.                        
  2233.      9       Item is a binary file!  Client must read until the connection      
  2234.                  closes.  Beware.                                               
  2235.      T       TN3270 connection.                                                 
  2236.                                                                                 
  2237.      Experimental IDs.                                                          
  2238.                                                                                 
  2239.      s       Sound type.  Data stream is a mulaw sound.                         
  2240.      g       GIF type.                                                          
  2241.      M       MIME type.  Item contains MIME data.                               
  2242.      h       html type.                                                         
  2243.      I       Image type.                                                        
  2244.      i       "inline" text type (used by panda).                                
  2245.                                                                                 
  2246. -------------------------------------------------------------------             
  2247. Q10: When I do full-text searches I always get every document back, Why?        
  2248.                                                                                 
  2249. A10: This is a problem occasionally encountered with Unix full-text             
  2250.      indexes.  It is caused by setting up the link incorrectly to a             
  2251.      gindexd port.                                                              
  2252.                                                                                 
  2253.      The Path= field should be *blank* when pointing to a gindexd               
  2254.      index.                                                                     
  2255.                                                                                 
  2256.      Otherwise the client will send the path to the gindexd daemon,             
  2257.      which interprets everything as a keyword.  This path is                    
  2258.      likely to contain a pathname that is common to all of the indexed          
  2259.      files.  Thus a search generates hits on everything.                        
  2260.                                                                                 
  2261. -------------------------------------------------------------------             
  2262. Q11: When I try to build the UNIX software I get an error from make:            
  2263.      "Must be a separator on rules line #. Stop"  Why?                          
  2264.                                                                                 
  2265. A11: This is a problem with older makes that don't understand the "include"     
  2266.      keyword.  One easy way to cope with this problem is compiling GNU          
  2267.      make, which does understand the include keyword.                           
  2268.                                                                                 
  2269.      If this is too difficult, remove the line:                                 
  2270.                                                                                 
  2271.       include Makefile.config                                                   
  2272.                                                                                 
  2273.      from all the Makefiles and paste in a copy of Makefile.config at           
  2274.      the top of each Makefile.                                                  
  2275.                                                                                 
  2276.      Or, instead of pasting you can make the client/server by going             
  2277.      into the appropriate directory and typing:                                 
  2278.                                                                                 
  2279.       make -f ../Makefile.config -f Makefile                                    
  2280.                                                                                 
  2281. -------------------------------------------------------------------             
  2282. Q12: What is the relationship between Gopher and (WAIS, WWW, ftp)?              
  2283.                                                                                 
  2284. A12: Gopher is intimately intertwined with these two other systems.             
  2285.      As shipped the Unix gopher server has the capability to:                   
  2286.                                                                                 
  2287.        - Search local WAIS indices.                                             
  2288.        - Query remote WAIS servers and funnel the results to gopher             
  2289.          clients.                                                               
  2290.        - Query remote ftp sites and funnel the results to gopher                
  2291.          clients.                                                               
  2292.        - Be queried by WWW (World Wide Web) clients (either using               
  2293.          built in gopher querying or using native http querying.                
  2294.                                                                                 
  2295. -------------------------------------------------------------------             
  2296. Q13: Are papers or articles describing gopher available?                        
  2297.                                                                                 
  2298. A13: Gopher has a whole chapter devoted to it in :                              
  2299.                                                                                 
  2300.      _The_Whole_Internet_, Ed Kroll, O'Reilly, 1992 (Editors note:              
  2301.                              ..Great book, go out and buy a bunch!)             
  2302.                                                                                 
  2303.      Other references include:                                                  
  2304.                                                                                 
  2305.      _The_Internet_Gopher_, "ConneXions", July 1992, Interop.                   
  2306.                                                                                 
  2307.      _Exploring_Internet_GopherSpace_ "The Internet Society News", v1n2 1992,   
  2308.                                                                                 
  2309.      (You can subscribe to the Internet Society News by sending e-mail to       
  2310.       isoc@nri.reston.va.us)                                                    
  2311.                                                                                 
  2312.      _The_Internet_Gopher_Protocol_, Proceedings of the Twenty-Third            
  2313.           IETF, CNRI, Section 5.3                                               
  2314.                                                                                 
  2315.      _Internet_Gopher_, Proceedings of Canadian Networking '92                  
  2316.                                                                                 
  2317.      _The_Internet_Gopher_, INTERNET: Getting Started, SRI                      
  2318.           International, Section 10.5.5                                         
  2319.                                                                                 
  2320.      _Tools_help_Internet_users_discover_on-line_treasures, Computerworld,      
  2321.           July 20, 1992                                                         
  2322.                                                                                 
  2323.      _TCP/IP_Network_Administration_, O'Reilly.                                 
  2324.                                                                                 
  2325.       Balakrishan, B. (Oct 1992)                                                
  2326.         "SPIGopher: Making SPIRES databases accessible through the              
  2327.       Gopher protocol".  SPIRES Fall '92 Workshop, Chapel Hill, North           
  2328.       Carolina.                                                                 
  2329.                                                                                 
  2330. -------------------------------------------------------------------             
  2331. Q14: On a DECstation I get the error message "/etc/svc.conf no such file        
  2332.      or directory" when running the gopherd server, why?                        
  2333.                                                                                 
  2334. A14: This is caused by the chroot() call in gopherd.  It can be easily          
  2335.      fixed by running gopherd with the -c option.                               
  2336.                                                                                 
  2337.      Alternatively you can copy /etc/svc.conf into a directory named            
  2338.      "etc" inside the gopher-data directory.                                    
  2339. -------------------------------------------------------------------             
  2340. Q15: The boolean searching terms don't work for my full-text index, why?        
  2341.                                                                                 
  2342. A15: This is probably because the searching is being provided by WAIS.          
  2343.      WAIS opts to return all documents that contain a search phrase             
  2344.      within certain limits.  WAIS searches do return the documents with         
  2345.      the highest "score" at the top, those documents will have the              
  2346.      closest relevance.                                                         
  2347. -------------------------------------------------------------------             
  2348. Q16: When linking the Unix gopher server with WAIS I get undefined symbols,     
  2349.      such as:                                                                   
  2350.                                                                                 
  2351.          log_file_name                                                          
  2352.          logfile                                                                
  2353.          PrintStatus                                                            
  2354.          find_value                                                             
  2355.          Sources                                                                
  2356.          NumSources                                                             
  2357.                                                                                 
  2358. A17: This happens if you make gopherd before linking in the WAIS ir/ui          
  2359.      directories.  The fix is to "make clean" or remove                         
  2360.      gopherd/{waisgopher.o,Waisindex.o} and then remake gopherd.  Or            
  2361.      link the ir/ui directories first.                                          
  2362. -------------------------------------------------------------------             
  2363. Q18: Why don't my WAIS indexes work?  I never get anything back for searches.   
  2364.      or Why do I get "Dangling file" error messages in my logfile?              
  2365.                                                                                 
  2366. A18: The problem could be in the server.  The server should be run              
  2367.      using the -c option if you want WAIS to work.  Another solution is to      
  2368.      patch the WAIS code so that it doesn't check the files on the disk.        
  2369.      Search the gopher-news archive for "dangling".  This will turn up a        
  2370.      single document with the patch.                                            
  2371.                                                                                 
  2372. -------------------------------------------------------------------             
  2373. Q19: My gopher server doesn't work under inetd, why?                            
  2374.                                                                                 
  2375. A19: It could be that your inetd server only supports a limited amount          
  2376.      of arguments.  For instance, the maximum number of arguments to an         
  2377.      inetd server is 5.  You can get around this by combining arguments: i.e.   
  2378.                                                                                 
  2379.        gopherd -I -c                                                            
  2380.                                                                                 
  2381.      becomes:                                                                   
  2382.                                                                                 
  2383.        gopherd -Ic                                                              
  2384.                                                                                 
  2385.      You may also leave the port specifier off of the command line.             
  2386.      The gopher server automagically finds out the port it's running on.        
  2387.                                                                                 
  2388. -------------------------------------------------------------------             
  2389. Q20: This is not a bug report, just a curiousity. I managed to install          
  2390.      gopher on my PC, more or less by myself, which is a pretty good            
  2391.      accomplishment, for someone who hasn't installed hardly anything on a      
  2392.      PC. I then proceeded to load my PC/TCP kernel, ETHDRV, and try to          
  2393.      start up gopher. It said it couldn't initialize that stack(?). I have      
  2394.      to load this whenever I use PC/TCP. Incredibly, when I did not load        
  2395.      ETHDRV, Gopher came up immediately and telneted to our local server.       
  2396.      How does it know what kernel to load?                                      
  2397.                                                                                 
  2398. A20 Dr. Science says,                                                           
  2399.                                                                                 
  2400.      The Internet Gopher program is not actually computer program at            
  2401.      all, but a collection of magical incantations handed down from Dark        
  2402.      Age conjurors.  It works by sending magical "demons" through the air,      
  2403.      which scour the world for information, and then return to cast             
  2404.      illusions containing the answer.                                           
  2405.                                                                                 
  2406.      When you use the Gopher, your computer isn't actually doing                
  2407.      anything at all.  Instead, these demons have mesmirized you with an        
  2408.      evil magical spell, which was invoked by the pattern of                    
  2409.      finger-movements peculiar to the typing of the letters G-O-P-H-E-R on      
  2410.      your keyboard.  This spell transmits demonic information directly to       
  2411.      your brain.                                                                
  2412.                                                                                 
  2413.      Scientists aren't certain of the long-term effects of demonic              
  2414.      mesmirization, although former presidents have suffered only minor         
  2415.      medical side-effects from it.  Indeed, since Magic and Science are         
  2416.      usually opposed to each other, most Scientists are usually                 
  2417.      close-minded about such issues, and will usually respond with some         
  2418.      vacuous non-answer about "packet drivers", "stacks", and other such        
  2419.      jargon.                                                                    
  2420.                                                                                 
  2421.      Unlike conventional scientists, Dr. Science is very open-minded and        
  2422.      is willing to deal with such issues in a frank and honest manner.          
  2423.      This is why people come to him with questions, and why they've learned     
  2424.      to rely on and live by his answers.                                        
  2425.                                                                                 
  2426.      Dr. Science                                                                
  2427.          "I'm not a real doctor;  I have a Master's Degree....  in SCIENCE!"    
  2428.                                                                                 
  2429. :-) :-) :-) :-)                                                                 
  2430. There's always room for a little humor in a FAQ..                               
  2431. -------------------------------------------------------------------             
  2432. Q21: Help!  I have PC-NFS and want to use the PC-Gopher client.  How?           
  2433.                                                                                 
  2434. A21: Use a piece of software called PKTMUX, available at fine ftp               
  2435.      sites everywhere.  This will let you use any packet driver                 
  2436.      application.                                                               
  2437.                                                                                 
  2438.      Or, aquire a client that supports PC-NFS.  See Q2.                         
  2439. -------------------------------------------------------------------             
  2440. Q22: How do I nuke a hung TCP connection?  I can't restart my UNIX              
  2441.      gopher server unless I get rid of it, and I don't want to reboot!          
  2442.                                                                                 
  2443. A22:                                                                            
  2444.                                                                                 
  2445. Here is an example of using dbx to change a socket from CLOSING to              
  2446. CLOSED.                                                                         
  2447.                                                                                 
  2448.  # netstat -A|grep CLOSING                                                      
  2449.  c4bc5100 tcp        0     11  mymachine.gopher 129.89.8.4.70  CLOSING          
  2450.  # dbx -k /vmunix /dev/mem                                                      
  2451.  ...                                                                            
  2452.  (dbx) 0xc4bc5100+8/1X                  -- display contents of PCB+8            
  2453.  c4bc5108:   00000007                                                           
  2454.  (dbx) assign 0xc4bc5108=0              -- zero it                              
  2455.  0                                                                              
  2456.  (dbx) q                                                                        
  2457.                                                                                 
  2458. After a minute or two, the CLOSED socket should disappear.                      
  2459. -------------------------------------------------------------------             
  2460. Q23: Is there somewhere I can retrieve a list of announced gopher               
  2461.      links?  I'd like to keep a local, up-to-date list of available gopher      
  2462.      holes without requiring our users to gopher to umn just to scan            
  2463.      GopherSpace.                                                               
  2464.                                                                                 
  2465. A23: In the Unix client/server distribution is a perl script called             
  2466.      "gopherdist". Gopherdist can fetch the contents of any point in            
  2467.      GopherSpace.                                                               
  2468.                                                                                 
  2469.      To dump the contents of all the North American links from                  
  2470.      gopher.tc.umn.edu do the following:                                        
  2471.                                                                                 
  2472.      % gopherdist gopher.tc.umn.edu 70 "1/Other Gopher and Information          
  2473.        Servers/North America" > .Links                                          
  2474. --                                                                              
  2475.  | Paul Lindner | lindner@boombox.micro.umn.edu   | Slipping into madness       
  2476.  |              | Computer & Information Services | is good for the sake        
  2477.  | Gophermaster | University of Minnesota         | of comparision.             
  2478. ///// / / /    /////// / / / /  /  /  /   /      //// / / / /  /  /  /   /      
  2479.                                                                                 
  2480.                                                                                 
  2481. ./ ENDUP                                                                        
  2482. ?!                                                                              
  2483. //C        EXEC GGLOAD,TRK1='14',TO='C'                                         
  2484. //SYSIN    DD DATA,DLM='?!'                                                     
  2485. ./   ADD NAME=GGCLIENT,SSI=01180054                                             
  2486.                                                                                 
  2487.  /********************************************************************/         
  2488.  /*                                                                  */         
  2489.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  2490.  /*                                                                  */         
  2491.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  2492.  /*                                                                  */         
  2493.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  2494.  /* including the implied warranties of merchantability and fitness, */         
  2495.  /* are expressly denied.                                            */         
  2496.  /*                                                                  */         
  2497.  /* Provided this copyright notice is included, this software may    */         
  2498.  /* be freely distributed and not offered for sale.                  */         
  2499.  /*                                                                  */         
  2500.  /* Changes or modifications may be made and used only by the maker  */         
  2501.  /* of same, and not further distributed.  Such modifications should */         
  2502.  /* be mailed to the author for consideration for addition to the    */         
  2503.  /* software and incorporation in subsequent releases.               */         
  2504.  /*                                                                  */         
  2505.  /********************************************************************/         
  2506.                                                                                 
  2507. #ifdef SASC                                                                     
  2508. #pragma  runopts(EXECOPS)                                                       
  2509. #else                                                                           
  2510. #pragma  runopts(heap(8k,8k,anywhere,))                                         
  2511. #pragma  runopts(nospie,nostae)                                                 
  2512. #endif                                                                          
  2513.                                                                                 
  2514. #pragma  csect(code,  "GG@LIENT")                                               
  2515. #pragma  csect(static,"GG$LIENT")                                               
  2516. #include "gg.h"                                                                 
  2517.                                                                                 
  2518. /*********************************************************************/         
  2519.                                                                                 
  2520. static char copyright_notice[] =                                                
  2521.    "Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992   \n\         
  2522.                                                                     \n\         
  2523.     GOPHER server due to Shawn Hart at the University of Delaware.  \n\         
  2524.                                                                     \n\         
  2525.     This software is provided on an 'AS IS' basis.  All warranties, \n\         
  2526.     including the implied warranties of merchantability and fitness,\n\         
  2527.     are expressly denied.                                           \n\         
  2528.                                                                     \n\         
  2529.     Provided this copyright notice is included, this software may   \n\         
  2530.     be freely distributed and not offered for sale.                 \n\         
  2531.                                                                     \n\         
  2532.     Changes or modifications may be made and used only by the maker \n\         
  2533.     of same, and not further distributed.  Such modifications should\n\         
  2534.     be mailed to the author for consideration for addition to the   \n\         
  2535.     software and incorporation in subsequent releases.";                        
  2536.                                                                                 
  2537. /*********************************************************************/         
  2538.                                                                                 
  2539. #ifdef I370                                                                     
  2540. char * _style = "tso:";                                                         
  2541. #endif                                                                          
  2542.                                                                                 
  2543. /*********************************************************************/         
  2544.                                                                                 
  2545. static Bool                                                                     
  2546. go_for_it(gp,ip)                                                                
  2547. struct ggcb            *gp;                                                     
  2548. struct gopherinfo      *ip;                                                     
  2549. {                                                                               
  2550.  char                   temp   [32];                                            
  2551.                                                                                 
  2552.  (void)GGMivget(gp,"GGHOST ",ip->host,sizeof(ip->host));                        
  2553.  (void)GGMivget(gp,"GGPATH ",ip->path,sizeof(ip->path));                        
  2554.  (void)GGMivget(gp,"GGDESC ",ip->desc,sizeof(ip->desc));                        
  2555.  (void)GGMivget(gp,"GGPORT ",temp    ,sizeof(temp)    );                        
  2556.  ip->type = INITIAL_TYPE;                                                       
  2557.  if (!*ip->path) strcpy(ip->path,INITIAL_PATH);                                 
  2558.  if (!*ip->host) strcpy(ip->host,INITIAL_HOST);                                 
  2559.  if (!*ip->desc) strcpy(ip->desc,INITIAL_DESC);                                 
  2560.  ip->port = atoi(temp);                                                         
  2561.  if (ip->port == 0) ip->port = INITIAL_PORT;                                    
  2562.                                                                                 
  2563.  return GGMgofor(gp,ip,FALSE);                                                  
  2564.                                                                                 
  2565. }                                                                               
  2566.                                                                                 
  2567. /*********************************************************************/         
  2568.                                                                                 
  2569. int                                                                             
  2570. main(argc,argv)                                                                 
  2571. int      argc;                                                                  
  2572. char   **argv;                                                                  
  2573.                                                                                 
  2574. {                                                                               
  2575.  struct ggcb            *gp;                                                    
  2576.  struct gopherinfo      *ip;                                                    
  2577.  char                   *p;                                                     
  2578.  int                     i;                                                     
  2579.  int                     exit_return_code;                                      
  2580.  Bool                    bypass_startup;                                        
  2581.  struct ggcb             gg;                                                    
  2582.  char                    zerrsm [25];                                           
  2583.  char                    zerrlm [73];                                           
  2584.                                                                                 
  2585.  exit_return_code = 0;                                                          
  2586.                                                                                 
  2587.  memset(&gg,0,sizeof(struct ggcb));                                             
  2588.                                                                                 
  2589.  gp = ≫                                                                      
  2590.                                                                                 
  2591.  /* set up top-level gopherinfo structure */                                    
  2592.                                                                                 
  2593.  GETMAIN(ip, struct gopherinfo, 1, "top-level gopherinfo struct");              
  2594.  if (!ip) {                                                                     
  2595.    fprintf(stderr,"Not enough memory to start up GOPHER\n");                    
  2596.    exit(16);                                                                    
  2597.  }                                                                              
  2598.                                                                                 
  2599.  memset(ip,0,sizeof(struct gopherinfo));                                        
  2600.                                                                                 
  2601.  gp->ginfo = ip;                                                                
  2602.                                                                                 
  2603.  gp->test_mode  = FALSE;                                                        
  2604.  gp->debug_mode = FALSE;                                                        
  2605.  gp->local_mode = FALSE;                                                        
  2606.  bypass_startup = FALSE;                                                        
  2607.                                                                                 
  2608.  for (i = 1; i < argc; i++) {                                                   
  2609.    p = argv[i];                                                                 
  2610.    if (*p == '-') {                                                             
  2611.      while (*++p) {                                                             
  2612.        switch (toupper(*p)) {                                                   
  2613.          case 'T':  gp->test_mode  = TRUE;    break;                            
  2614.          case 'D':  gp->debug_mode = TRUE;    break;                            
  2615.          case 'L':  gp->local_mode = TRUE;    break;                            
  2616.          case 'Q':  bypass_startup = TRUE;    break;                            
  2617.          default: fprintf(stderr,"GGMVS: Bad parameter flag %c\n", *p);         
  2618.                   exit_return_code = 8;                                         
  2619.        }                                                                        
  2620.      }                                                                          
  2621.    }                                                                            
  2622.    else {                                                                       
  2623.      fprintf(stderr,"GGMVS: Bad parameter string %s\n",p);                      
  2624.      exit_return_code = 8;                                                      
  2625.    }                                                                            
  2626.  }                                                                              
  2627.                                                                                 
  2628.  if (gp->test_mode) __ctest(NULL);                                              
  2629.                                                                                 
  2630.  if (gp->debug_mode) {                                                          
  2631.    if (!(gp->debug_file = fopen("dd:ggdebug","w"))) {                           
  2632.      perror("debug file (DD GGDEBUG)");                                         
  2633.      exit_return_code = 4;                                                      
  2634.    }                                                                            
  2635.  }                                                                              
  2636.  else gp->debug_file = NULL;                                                    
  2637.                                                                                 
  2638.  gp->thdr.first_text_line = NULL;                                               
  2639.                                                                                 
  2640.  GGMclrtx(gp,NULL);               /* Clear text       */                        
  2641.  GGMclrtx(gp,ip);                 /* Clear text       */                        
  2642.                                                                                 
  2643.  gp->g_bytes_returned = 0;                                                      
  2644.  gp->g_buf_index      = -1;                                                     
  2645.                                                                                 
  2646.  /* Determine the local path name. Done in GGMCONN when needed now */           
  2647.                                                                                 
  2648.  strcpy(gp->ggserver,"");                                                       
  2649.  gp->connected_to_server   = FALSE;                                             
  2650.  gp->closing_connection    = FALSE;                                             
  2651.  gp->reconnect_in_progress = FALSE;                                             
  2652.  gp->receiving_text        = FALSE;                                             
  2653.                                                                                 
  2654.  GETMAIN(gp->server_buf,    char,SERVER_BUF_MSGSIZE+4,"server buffer");         
  2655.  GETMAIN(gp->client_buf,    char,CLIENT_BUF_MSGSIZE+4,"client buffer");         
  2656.  GETMAIN(gp->gopher_command,char,CLIENT_BUF_MSGSIZE+4,"gopher command");        
  2657.                                                                                 
  2658. #ifdef FETCH                                                                    
  2659.                                                                                 
  2660.  gp->isplink_pointer = (int (*) ())fetch("ISPLINK");                            
  2661.  gp->ispexec_pointer = (int (*) ())fetch("ISPEXEC");                            
  2662.                                                                                 
  2663. #endif                                                                          
  2664.                                                                                 
  2665.  if (!GGMispf(gp,"CONTROL ERRORS RETURN")) exit_return_code = 20;               
  2666.                                                                                 
  2667.  else {                                                                         
  2668.                                                                                 
  2669.    exit_return_code = 0;                                                        
  2670.                                                                                 
  2671.    /* not done yet:  set up command and selection code tables */                
  2672.                                                                                 
  2673.    GGMsopt(gp,OPTION_ALL);      /* set options */                               
  2674.                                                                                 
  2675.    if (bypass_startup) {                                                        
  2676.      (void)GGMispf(gp,"VGET (GGHOST GGPATH GGDESC GGPORT) PROFILE");            
  2677.      (void)go_for_it(gp,ip);                                                    
  2678.    }                                                                            
  2679.    else {                                                                       
  2680.      (void)GGMivput(gp,"ZCMD "    ,"",-1);                                      
  2681.      while (GGMdispl(gp,"GGM     ") == 0                                        
  2682.          && !gp->quit                                                           
  2683.          && !go_for_it(gp,ip)) ;                                                
  2684.    }                                                                            
  2685.  }                                                                              
  2686.                                                                                 
  2687.  if (gp->setmsg) {                                                              
  2688.    (void)GGMivget(gp,"ZERRSM ",zerrsm, sizeof(zerrsm));                         
  2689.    (void)GGMivget(gp,"ZERRLM ",zerrlm, sizeof(zerrlm));                         
  2690.    fprintf(stderr,"%s: %s\n",zerrsm,zerrlm);                                    
  2691.    gp->setmsg = FALSE;                                                          
  2692.  }                                                                              
  2693.                                                                                 
  2694.  if (gp->connected_to_server) {                                                 
  2695.    GGMdisc(gp);                 /* disconnect from news server */               
  2696.  }                                                                              
  2697.                                                                                 
  2698.  FREEMAIN(gp->gopher_command,"gopher command");                                 
  2699.  FREEMAIN(gp->server_buf,    "server buffer");                                  
  2700.  FREEMAIN(gp->client_buf,    "client buffer");                                  
  2701.  FREEMAIN(gp->ginfo,         "top-level gopherinfo struct");                    
  2702.                                                                                 
  2703.  #define FINAL_CLOSE(A,B) \                                                     
  2704.    if (A) { \                                                                   
  2705.             if (fclose(A) < 0) fprintf(stderr,B); \                             
  2706.           }                                                                     
  2707.                                                                                 
  2708.  FINAL_CLOSE(gp->debug_file, "Error closing debug file\n");                     
  2709.                                                                                 
  2710.  exit(exit_return_code);                                                        
  2711. }                                                                               
  2712.                                                                                 
  2713. ./   ADD NAME=GGMALLOC,SSI=01030039                                             
  2714.                                                                                 
  2715.  /********************************************************************/         
  2716.  /*                                                                  */         
  2717.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  2718.  /*                                                                  */         
  2719.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  2720.  /*                                                                  */         
  2721.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  2722.  /* including the implied warranties of merchantability and fitness, */         
  2723.  /* are expressly denied.                                            */         
  2724.  /*                                                                  */         
  2725.  /* Provided this copyright notice is included, this software may    */         
  2726.  /* be freely distributed and not offered for sale.                  */         
  2727.  /*                                                                  */         
  2728.  /* Changes or modifications may be made and used only by the maker  */         
  2729.  /* of same, and not further distributed.  Such modifications should */         
  2730.  /* be mailed to the author for consideration for addition to the    */         
  2731.  /* software and incorporation in subsequent releases.               */         
  2732.  /*                                                                  */         
  2733.  /********************************************************************/         
  2734.                                                                                 
  2735. #pragma  csect(code,  "GG@ALLOC")                                               
  2736. #pragma  csect(static,"GG$ALLOC")                                               
  2737. #include "gg.h"                                                                 
  2738.                                                                                 
  2739. /****** Allocate a data set. *****************************************/         
  2740.                                                                                 
  2741. enum data_set_type                                                              
  2742. GGMalloc(dsname,ddname,wanted_type,nitems)                                      
  2743. char                      *dsname;                                              
  2744. char                      *ddname;                                              
  2745. enum data_set_type         wanted_type;                                         
  2746. int                        nitems;                                              
  2747. {                                                                               
  2748.  int                       i;                                                   
  2749.  int                       rc;                                                  
  2750.  char                     *cp;                                                  
  2751.  enum data_set_type        return_type;                                         
  2752.  Bool                      try_new;                                             
  2753.  short                     primary_allocation   ;                               
  2754.  short                     secondary_allocation ;                               
  2755.  short                     directory_blocks     ;                               
  2756.  short                     dsorg                ;                               
  2757.  __S99parms                stuff99; /* No "struct", despite manual */           
  2758.  TEXTUNIT                 *tu [17];                                             
  2759.  TEXTUNIT                  tu_dsn;                                              
  2760.  TEXTUNIT                  tu_ddn;                                              
  2761.  TEXTUNIT                  tu_member;                                           
  2762.  TEXTUNIT                  tu_stat;                                             
  2763.  TEXTUNIT                  tu_disp;                                             
  2764.  TEXTUNIT                  tu_perm;                                             
  2765.  TEXTUNIT                  tu_rtddn;                                            
  2766.  TEXTUNIT                  tu_rtorg;                                            
  2767.  TEXTUNIT                  tu_block;                                            
  2768.  TEXTUNIT                  tu_prime;                                            
  2769.  TEXTUNIT                  tu_sec;                                              
  2770.  TEXTUNIT                  tu_dir;                                              
  2771.  TEXTUNIT                  tu_recfm;                                            
  2772.  TEXTUNIT                  tu_lrecl;                                            
  2773.  TEXTUNIT                  tu_blksz;                                            
  2774.  TEXTUNIT                  tu_dsorg;                                            
  2775.  char                     *lparp;                                               
  2776.  char                     *rparp;                                               
  2777.  char                      dsnseq [81];                                         
  2778.  char                      member [81];                                         
  2779.  char                      what_to_open[81];                                    
  2780.  FILE                     *mfile;                                               
  2781.                                                                                 
  2782.  try_new = FALSE;                                                               
  2783.                                                                                 
  2784.  memset((char *)&stuff99,0,sizeof(__S99parms));                                 
  2785.                                                                                 
  2786.  strcpy(member,"");                                                             
  2787.  strcpy(dsnseq,dsname);                                                         
  2788.  lparp = strchr(dsnseq,'(');                                                    
  2789.  rparp = strchr(dsnseq,')');                                                    
  2790.  if (lparp && rparp && (lparp < rparp) && (*(rparp+1) == '\0')) {               
  2791.    *lparp = '\0';            /* makes dsnseq the seq part only */               
  2792.    *rparp = '\0';            /* turns member into a string     */               
  2793.    strcpy(member, lparp+1);                                                     
  2794.    wanted_type = PDS;                                                           
  2795.  }                                                                              
  2796.                                                                                 
  2797.  for (;;) {                                                                     
  2798.                                                                                 
  2799.    stuff99.__S99RBLN   = 20;                                                    
  2800.    stuff99.__S99VERB   = S99VRBAL;                                              
  2801.    stuff99.__S99FLAG1  = S99NOCNV << 8;                                         
  2802.    stuff99.__S99ERROR  = 0;                                                     
  2803.    stuff99.__S99INFO   = 0;                                                     
  2804.    stuff99.__S99TXTPP  = tu;                                                    
  2805.    stuff99.__S99FLAG2  = 0;                                                     
  2806.                                                                                 
  2807.    i = 0;                                                                       
  2808.                                                                                 
  2809.    tu[i++] = &tu_dsn;                                                           
  2810.                                                                                 
  2811.    tu_dsn.key        = DALDSNAM;                                                
  2812.    tu_dsn.num        = 1;                                                       
  2813.    tu_dsn.ent.len    = strlen(dsnseq);                                          
  2814.    strcpy(tu_dsn.ent.prm,dsnseq);                                               
  2815.    for (cp=tu_dsn.ent.prm; *cp; cp++) *cp = toupper(*cp);                       
  2816.                                                                                 
  2817.    tu[i++] = &tu_stat;                                                          
  2818.                                                                                 
  2819.    tu_stat.key      = DALSTATS;                                                 
  2820.    tu_stat.num      = 1;                                                        
  2821.    tu_stat.ent.len  = 1;                                                        
  2822.    *tu_stat.ent.prm = (try_new ? NEW : SHR);                                    
  2823.                                                                                 
  2824.    tu[i++] = &tu_disp;                                                          
  2825.                                                                                 
  2826.    tu_disp.key      = DALNDISP;                                                 
  2827.    tu_disp.num      = 1;                                                        
  2828.    tu_disp.ent.len  = 1;                                                        
  2829.    *tu_disp.ent.prm = (try_new ? CATLG : KEEP);                                 
  2830.                                                                                 
  2831.    tu[i++] = &tu_rtorg;                                                         
  2832.                                                                                 
  2833.    tu_rtorg.key     = DALRTORG;                                                 
  2834.    tu_rtorg.num     = 1;                                                        
  2835.    tu_rtorg.ent.len = 2;                                                        
  2836.                                                                                 
  2837.    if (*member) {                                                               
  2838.                                                                                 
  2839.      tu[i++] = &tu_member;                                                      
  2840.                                                                                 
  2841.      tu_member.key     = DALMEMBR;                                              
  2842.      tu_member.num     = 1;                                                     
  2843.      tu_member.ent.len = strlen(member);                                        
  2844.      strcpy(tu_member.ent.prm,member);                                          
  2845.      for (cp=tu_member.ent.prm; *cp; cp++) *cp = toupper(*cp);                  
  2846.                                                                                 
  2847.    }                                                                            
  2848.                                                                                 
  2849.    if (ddname && *ddname) {                                                     
  2850.                                                                                 
  2851.      tu[i++] = &tu_ddn;                                                         
  2852.                                                                                 
  2853.      tu_ddn.key     = DALDDNAM;                                                 
  2854.      tu_ddn.num     = 1;                                                        
  2855.      tu_ddn.ent.len = strlen(ddname);                                           
  2856.      strcpy(tu_ddn.ent.prm,ddname);                                             
  2857.      for (cp=tu_ddn.ent.prm; *cp; cp++) *cp = toupper(*cp);                     
  2858.                                                                                 
  2859.      tu[i++] = &tu_perm;                                                        
  2860.                                                                                 
  2861.      tu_perm.key     = DALPERMA;                                                
  2862.      tu_perm.num     = 0;                                                       
  2863.    }                                                                            
  2864.    else {                                                                       
  2865.                                                                                 
  2866.      tu[i++] = &tu_rtddn;                                                       
  2867.                                                                                 
  2868.      tu_rtddn.key     = DALRTDDN;                                               
  2869.      tu_rtddn.num     = 1;                                                      
  2870.      tu_rtddn.ent.len = 8;                                                      
  2871.      memset(tu_rtddn.ent.prm,' ',8);                                            
  2872.                                                                                 
  2873.    }                                                                            
  2874.                                                                                 
  2875.    if (try_new) {                                                               
  2876.                                                                                 
  2877.      switch (wanted_type) {                                                     
  2878.        case PDS:                                                                
  2879.                  primary_allocation   = (short)nitems;                          
  2880.                  secondary_allocation = primary_allocation;                     
  2881.                  directory_blocks     = ((short)nitems/(12*36)+1) * 36;         
  2882.                  dsorg                = DSORG_PO;                               
  2883.                  break;                                                         
  2884.        case SEQ:                                                                
  2885.        default:                                                                 
  2886.                  primary_allocation   = (short)nitems;                          
  2887.                  secondary_allocation = primary_allocation;                     
  2888.                  directory_blocks     = 0;                                      
  2889.                  dsorg                = DSORG_PS;                               
  2890.                  break;                                                         
  2891.      }                                                                          
  2892.                                                                                 
  2893.      tu[i++] = &tu_block;                                                       
  2894.                                                                                 
  2895.      tu_block.key     = DALBLKLN;                                               
  2896.      tu_block.num     = 1;                                                      
  2897.      tu_block.ent.len = 3;                                                      
  2898.      memset(tu_block.ent.prm,0,3);                                              
  2899.      *(short *)(tu_block.ent.prm+1) = 6233;                                     
  2900.                                                                                 
  2901.      tu[i++] = &tu_prime;                                                       
  2902.                                                                                 
  2903.      tu_prime.key     = DALPRIME;                                               
  2904.      tu_prime.num     = 1;                                                      
  2905.      tu_prime.ent.len = 3;                                                      
  2906.      memset(tu_prime.ent.prm,0,3);                                              
  2907.      *(short *)(tu_prime.ent.prm+1) = primary_allocation;                       
  2908.                                                                                 
  2909.      tu[i++] = &tu_sec;                                                         
  2910.                                                                                 
  2911.      tu_sec.key     = DALSECND;                                                 
  2912.      tu_sec.num     = 1;                                                        
  2913.      tu_sec.ent.len = 3;                                                        
  2914.      memset(tu_sec.ent.prm,0,3);                                                
  2915.      *(short *)(tu_sec.ent.prm+1) = secondary_allocation;                       
  2916.                                                                                 
  2917.      tu[i++] = &tu_dir;                                                         
  2918.                                                                                 
  2919.      tu_dir.key     = DALDIR;                                                   
  2920.      tu_dir.num     = 1;                                                        
  2921.      tu_dir.ent.len = 3;                                                        
  2922.      memset(tu_dir.ent.prm,0,3);                                                
  2923.      *(short *)(tu_dir.ent.prm+1) = directory_blocks;                           
  2924.                                                                                 
  2925.      tu[i++] = &tu_recfm;                                                       
  2926.                                                                                 
  2927.      tu_recfm.key        = DALRECFM;                                            
  2928.      tu_recfm.num        = 1;                                                   
  2929.      tu_recfm.ent.len    = 1;                                                   
  2930.      *tu_recfm.ent.prm   = RECFM_VB;                                            
  2931.                                                                                 
  2932.      tu[i++] = &tu_lrecl;                                                       
  2933.                                                                                 
  2934.      tu_lrecl.key        = DALLRECL;                                            
  2935.      tu_lrecl.num        = 1;                                                   
  2936.      tu_lrecl.ent.len    = 2;                                                   
  2937.      *(short *)tu_lrecl.ent.prm   = 259;                                        
  2938.                                                                                 
  2939.      tu[i++] = &tu_blksz;                                                       
  2940.                                                                                 
  2941.      tu_blksz.key        = DALBLKSZ;                                            
  2942.      tu_blksz.num        = 1;                                                   
  2943.      tu_blksz.ent.len    = 2;                                                   
  2944.      *(short *)tu_blksz.ent.prm   = 6233;                                       
  2945.                                                                                 
  2946.      tu[i++] = &tu_dsorg;                                                       
  2947.                                                                                 
  2948.      tu_dsorg.key        = DALDSORG;                                            
  2949.      tu_dsorg.num        = 1;                                                   
  2950.      tu_dsorg.ent.len    = 2;                                                   
  2951.      *(short *)tu_dsorg.ent.prm   = dsorg;                                      
  2952.                                                                                 
  2953.    }                                                                            
  2954.                                                                                 
  2955.    tu[i] = (void *)0x80000000;                                                  
  2956.                                                                                 
  2957.    rc = svc99(&stuff99);                                                        
  2958.                                                                                 
  2959.    if (rc == 0) {                                                               
  2960.      if (!(ddname && *ddname)) {                                                
  2961.        memcpy(ddname,(char *)tu_rtddn.ent.prm,8);                               
  2962.        *(ddname+8) = ' ';                                                       
  2963.        *(strchr(ddname,' ')) = '\0';                                            
  2964.      }                                                                          
  2965.      switch (tu_rtorg.ent.prm[0]) {                                             
  2966.        case 0x40:  return_type = SEQ; break;                                    
  2967.        case 0x02:  return_type = PDS; break;                                    
  2968.        default:    return_type = UNK; break;                                    
  2969.      }                                                                          
  2970.      if (wanted_type == SEQ && return_type != SEQ) {                            
  2971.        fprintf(stderr,"%s: not a sequential data set\n",dsname);                
  2972.      }                                                                          
  2973.      if (wanted_type == PDS && return_type != PDS) {                            
  2974.        fprintf(stderr,"%s: not a partitioned data set\n",dsname);               
  2975.      }                                                                          
  2976.      if (return_type == PDS && *member) return SEQ;                             
  2977.      else return return_type;                                                   
  2978.    }                                                                            
  2979.    else if (!try_new && nitems != 0 && stuff99.__S99ERROR == 0x1708) {          
  2980.     try_new = TRUE;                                                             
  2981.     continue;                                                                   
  2982.    }                                                                            
  2983.    else {                                                                       
  2984.      GGMdfail(rc,&stuff99);                                                     
  2985.      return UNK;                                                                
  2986.    }                                                                            
  2987.  }                                                                              
  2988. }                                                                               
  2989.                                                                                 
  2990. ./   ADD NAME=GGMBRIFC,SSI=01020028                                             
  2991.                                                                                 
  2992.  /********************************************************************/         
  2993.  /*                                                                  */         
  2994.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  2995.  /*                                                                  */         
  2996.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  2997.  /*                                                                  */         
  2998.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  2999.  /* including the implied warranties of merchantability and fitness, */         
  3000.  /* are expressly denied.                                            */         
  3001.  /*                                                                  */         
  3002.  /* Provided this copyright notice is included, this software may    */         
  3003.  /* be freely distributed and not offered for sale.                  */         
  3004.  /*                                                                  */         
  3005.  /* Changes or modifications may be made and used only by the maker  */         
  3006.  /* of same, and not further distributed.  Such modifications should */         
  3007.  /* be mailed to the author for consideration for addition to the    */         
  3008.  /* software and incorporation in subsequent releases.               */         
  3009.  /*                                                                  */         
  3010.  /********************************************************************/         
  3011.                                                                                 
  3012. #pragma  csect(code,  "GG@BRIFC")                                               
  3013. #pragma  csect(static,"GG$BRIFC")                                               
  3014. #include "gg.h"                                                                 
  3015.                                                                                 
  3016. /****** BRIF primary command function. *******************************/         
  3017.                                                                                 
  3018. int                                                                             
  3019. GGMbrifc(numptr,dialog_data_ptr)                                                
  3020. int                  *numptr;                                                   
  3021. void                 *dialog_data_ptr;                                          
  3022. {                                                                               
  3023.  Rstruc ggcb         *gp = *(Rstruc ggcb **)dialog_data_ptr;                    
  3024.  Rstruc gopherinfo   *ip = gp->ginfo;                                           
  3025.  struct gopherinfo   *ip1;                                                      
  3026.  char                 zcmd[80];                                                 
  3027.  char                 command[80];                                              
  3028.  char                 operand[80];                                              
  3029.  char                *p;                                                        
  3030.  int                  opoff;                                                    
  3031.                                                                                 
  3032.  /*                                                                             
  3033.   * For commands which are supposed to terminate the current BRIF               
  3034.   * (like NEXT and PREV), we return an invalid return code, which               
  3035.   * is documented to make BRIF itself return with a code of 16,                 
  3036.   * which we treat as a normal end.                                             
  3037.   */                                                                            
  3038.                                                                                 
  3039.  (void)GGMivget(gp,"ZCMD ",zcmd,sizeof(zcmd));                                  
  3040.  strcpy(command,"");                                                            
  3041.  strcpy(operand,"");                                                            
  3042.  if (1 <= sscanf(zcmd,"%s %n",&command,&opoff)) {                               
  3043.    for (p=command;*p;p++) *p = toupper(*p);                                     
  3044.    if ((EQUAL(command,"EXTRACT") ||  EQUAL(command,"EXT")))  {                  
  3045.      if (!ip) (void)GGMivput(gp,"GGTNUM ","",-1);                               
  3046.      gp->extract_file = NULL;                                                   
  3047.      (void)GGMispf(gp,"CONTROL DISPLAY SAVE");                                  
  3048.      (void)GGMxtx(gp,ip);                        /* Extract text */             
  3049.      (void)GGMispf(gp,"CONTROL DISPLAY RESTORE");                               
  3050.      return 0;                                                                  
  3051.    }                                                                            
  3052.    else                                                                         
  3053.    if (EQUAL(command,"PRT")) {                                                  
  3054.      (void)GGMispf(gp,"CONTROL DISPLAY SAVE");                                  
  3055.      GGMptx(gp,ip);            /* Print text */                                 
  3056.      (void)GGMispf(gp,"CONTROL DISPLAY RESTORE");                               
  3057.      return 0;                                                                  
  3058.    }                                                                            
  3059.    else                                                                         
  3060.    if (EQUAL(command,"QUIT")) {                                                 
  3061.      gp->quit = TRUE;                                                           
  3062.      return 1;                                                                  
  3063.    }                                                                            
  3064.    else {                                                                       
  3065.      ERR1(                                                                      
  3066.           "The only non-BROWSE commands available are EXTract and PRT."         
  3067.          );                                                                     
  3068.      return 12;                                                                 
  3069.    }                                                                            
  3070.  }                                                                              
  3071.                                                                                 
  3072.  return 4; /* ISPF-PDF should handle the command */                             
  3073.                                                                                 
  3074. }                                                                               
  3075.                                                                                 
  3076. ./   ADD NAME=GGMBRIFR,SSI=01000032                                             
  3077.                                                                                 
  3078.  /********************************************************************/         
  3079.  /*                                                                  */         
  3080.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3081.  /*                                                                  */         
  3082.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3083.  /*                                                                  */         
  3084.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3085.  /* including the implied warranties of merchantability and fitness, */         
  3086.  /* are expressly denied.                                            */         
  3087.  /*                                                                  */         
  3088.  /* Provided this copyright notice is included, this software may    */         
  3089.  /* be freely distributed and not offered for sale.                  */         
  3090.  /*                                                                  */         
  3091.  /* Changes or modifications may be made and used only by the maker  */         
  3092.  /* of same, and not further distributed.  Such modifications should */         
  3093.  /* be mailed to the author for consideration for addition to the    */         
  3094.  /* software and incorporation in subsequent releases.               */         
  3095.  /*                                                                  */         
  3096.  /********************************************************************/         
  3097.                                                                                 
  3098. #pragma  csect(code,  "GG@BRIFR")                                               
  3099. #pragma  csect(static,"GG$BRIFR")                                               
  3100. #include "gg.h"                                                                 
  3101.                                                                                 
  3102. /****** BRIF read function. ******************************************/         
  3103.                                                                                 
  3104. int                                                                             
  3105. GGMbrifr(dataptr,lenptr,recnoptr,dialog_data_ptr)                               
  3106. char                **dataptr;                                                  
  3107. int                  *lenptr;                                                   
  3108. int                  *recnoptr;                                                 
  3109. void                 *dialog_data_ptr;                                          
  3110. {                                                                               
  3111.  Rstruc textline     *tp;                                                       
  3112.  Rstruc ggcb         *gp;                                                       
  3113.  Rstruc texthdr      *thp;                                                      
  3114.         int           return_value;                                             
  3115.         int           current_recno;                                            
  3116.         int           i;                                                        
  3117.                                                                                 
  3118.  gp             = *(struct ggcb **)dialog_data_ptr;                             
  3119.  thp            = gp->brifp;                                                    
  3120.  current_recno  = *recnoptr;                                                    
  3121.  return_value   = 0;                                                            
  3122.  tp             = NULL;                                                         
  3123.                                                                                 
  3124.  if (current_recno == 99999999) {    /* scroll down max request */              
  3125.    tp = NULL;                                                                   
  3126.  }                                                                              
  3127.  else if (thp->current_text_line != NULL &&                                     
  3128.           current_recno == gp->brif_previous_recno+1) {                         
  3129.    tp = thp->current_text_line->next;                                           
  3130.    while (tp && tp->text_length < 0) tp = tp->next;                             
  3131.  }                                                                              
  3132.  else {                                                                         
  3133.    for (i = 0, tp = thp->first_text_line; tp; tp = tp->next) {                  
  3134.      if (tp->text_length >= 0) {                                                
  3135.        if (++i >= current_recno) break;                                         
  3136.      }                                                                          
  3137.    }                                                                            
  3138.  }                                                                              
  3139.                                                                                 
  3140.  if (tp == NULL) {                                                              
  3141.    *recnoptr = thp->text_line_count;                                            
  3142.    return_value = 8;                                                            
  3143.  }                                                                              
  3144.  else {                                                                         
  3145.    thp->current_text_line = tp;                                                 
  3146.    *dataptr = tp->tab_expanded_text;                                            
  3147.    *lenptr  = tp->tab_expanded_text_length;                                     
  3148.    return_value = 0;                                                            
  3149.  }                                                                              
  3150.                                                                                 
  3151.  gp->brif_previous_recno = current_recno;                                       
  3152.                                                                                 
  3153.  return return_value;                                                           
  3154.                                                                                 
  3155. }                                                                               
  3156.                                                                                 
  3157. ./   ADD NAME=GGMCLRTX,SSI=01000031                                             
  3158.                                                                                 
  3159.  /********************************************************************/         
  3160.  /*                                                                  */         
  3161.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3162.  /*                                                                  */         
  3163.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3164.  /*                                                                  */         
  3165.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3166.  /* including the implied warranties of merchantability and fitness, */         
  3167.  /* are expressly denied.                                            */         
  3168.  /*                                                                  */         
  3169.  /* Provided this copyright notice is included, this software may    */         
  3170.  /* be freely distributed and not offered for sale.                  */         
  3171.  /*                                                                  */         
  3172.  /* Changes or modifications may be made and used only by the maker  */         
  3173.  /* of same, and not further distributed.  Such modifications should */         
  3174.  /* be mailed to the author for consideration for addition to the    */         
  3175.  /* software and incorporation in subsequent releases.               */         
  3176.  /*                                                                  */         
  3177.  /********************************************************************/         
  3178.                                                                                 
  3179. #pragma  csect(code,  "GG@CLRTX")                                               
  3180. #pragma  csect(static,"GG$CLRTX")                                               
  3181. #include "gg.h"                                                                 
  3182.                                                                                 
  3183. /****** Clear text. **************************************************/         
  3184.                                                                                 
  3185. void                                                                            
  3186. GGMclrtx(gp,ip)                                                                 
  3187. Rstruc ggcb           *gp;                                                      
  3188. Rstruc gopherinfo     *ip;                                                      
  3189.                                                                                 
  3190. {                                                                               
  3191.  Rstruc texthdr       *thp;                                                     
  3192.  Rstruc textline      *tp1;                                                     
  3193.  Rstruc textline      *tp2;                                                     
  3194.                                                                                 
  3195.  /* If info is not specified, use main ggcb, else info's text */                
  3196.                                                                                 
  3197.  thp = (ip ? &ip->thdr : &gp->thdr);                                            
  3198.                                                                                 
  3199.  tp1=thp->first_text_line;                                                      
  3200.  while (tp1) {                                                                  
  3201.   tp2 = tp1->next;                                                              
  3202.   FREEMAIN(tp1,"text line");                                                    
  3203.   tp1 = tp2;                                                                    
  3204.  }                                                                              
  3205.                                                                                 
  3206.  thp->text_body_line    = NULL;                                                 
  3207.  thp->first_text_line   = NULL;                                                 
  3208.  thp->current_text_line = NULL;                                                 
  3209.  thp->last_text_line    = NULL;                                                 
  3210.  thp->text_line_count   = 0;                                                    
  3211.  thp->text_max_length   = 0;                                                    
  3212.  thp->text_max_tab_expanded_length   = 0;                                       
  3213.                                                                                 
  3214.  return;                                                                        
  3215.                                                                                 
  3216. }                                                                               
  3217.                                                                                 
  3218. ./   ADD NAME=GGMCONN,SSI=010D0008                                              
  3219.                                                                                 
  3220.  /********************************************************************/         
  3221.  /*                                                                  */         
  3222.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3223.  /*                                                                  */         
  3224.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3225.  /*                                                                  */         
  3226.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3227.  /* including the implied warranties of merchantability and fitness, */         
  3228.  /* are expressly denied.                                            */         
  3229.  /*                                                                  */         
  3230.  /* Provided this copyright notice is included, this software may    */         
  3231.  /* be freely distributed and not offered for sale.                  */         
  3232.  /*                                                                  */         
  3233.  /* Changes or modifications may be made and used only by the maker  */         
  3234.  /* of same, and not further distributed.  Such modifications should */         
  3235.  /* be mailed to the author for consideration for addition to the    */         
  3236.  /* software and incorporation in subsequent releases.               */         
  3237.  /*                                                                  */         
  3238.  /********************************************************************/         
  3239.                                                                                 
  3240. #pragma  csect(code,  "GG@CONN ")                                               
  3241. #pragma  csect(static,"GG$CONN ")                                               
  3242. #include "gg.h"                                                                 
  3243.                                                                                 
  3244. /****** Internet address formatter. **********************************/         
  3245.                                                                                 
  3246. static void                                                                     
  3247. format_ip_address(ia,is)                                                        
  3248. IPADDRESS   ia;                                                                 
  3249. char       *is;                                                                 
  3250. {                                                                               
  3251.  char *cp = (char *)&ia;                                                        
  3252.                                                                                 
  3253.  sprintf(is,"%d.%d.%d.%d",*cp,*(cp+1),*(cp+2),*(cp+3));                         
  3254.  return;                                                                        
  3255. }                                                                               
  3256.                                                                                 
  3257. /****** Get client hostname and IP address. **************************/         
  3258.                                                                                 
  3259. static Bool                                                                     
  3260. get_client_hostname(gp)                                                         
  3261. Rstruc ggcb *gp;                                                                
  3262. {                                                                               
  3263.  struct hostent    *client_hp;                                                  
  3264.  int                gethostnamerc;                                              
  3265.  int                hostlen;                                                    
  3266.  int                domslen;                                                    
  3267.                                                                                 
  3268.  gethostnamerc = gethostname(gp->client_hostname,MAXHOSTNAMELEN);               
  3269.  if (gethostnamerc < 0) {                                                       
  3270.    fprintf(stderr,"GGMVS: gethostname() failed, don't know my name\n");         
  3271.    return FALSE;                                                                
  3272.  }                                                                              
  3273.                                                                                 
  3274. #ifdef APPEND_DOMAIN_NAME_TO_SELF                                               
  3275.                                                                                 
  3276.  hostlen = strlen(gp->client_hostname);                                         
  3277.  domslen = sizeof(MY_DOMAIN_SUFFIX) - 1;                                        
  3278.  if (hostlen <= domslen ||                                                      
  3279.      memcmp(gp->client_hostname+hostlen-domslen,                                
  3280.             MY_DOMAIN_SUFFIX, domslen)) {                                       
  3281.    strncat(gp->client_hostname,MY_DOMAIN_SUFFIX,domslen);                       
  3282.  }                                                                              
  3283.                                                                                 
  3284. #endif                                                                          
  3285.                                                                                 
  3286.  uppercase_in_place(gp->client_hostname);                                       
  3287.                                                                                 
  3288.  client_hp = gethostbyname(gp->client_hostname);                                
  3289.  if (!client_hp) {                                                              
  3290.    fprintf(stderr,"GGMVS: gethostbyname() failed, can't get my name\n");        
  3291.    return FALSE;                                                                
  3292.  }                                                                              
  3293.                                                                                 
  3294.  strcpy(gp->ggclient,gp->client_hostname);                                      
  3295.  strcpy(gp->client_hostname, client_hp->h_name);                                
  3296.  gp->client_ip_address = *(IPADDRESS *)client_hp->h_addr;                       
  3297.                                                                                 
  3298.  return TRUE ;                                                                  
  3299.                                                                                 
  3300. }                                                                               
  3301.                                                                                 
  3302. /****** Connect to news server. **************************************/         
  3303.                                                                                 
  3304. Bool                                                                            
  3305. GGMconn(gp)                                                                     
  3306. Rstruc ggcb *gp;                                                                
  3307. {                                                                               
  3308.  char              *lp;                                                         
  3309.  char              *cp;                                                         
  3310.  struct recvstruct *R;                                                          
  3311.  struct hostent    *server_hp;                                                  
  3312.  struct sockaddr_in bindsock;       /* socket used by bind           */         
  3313.  struct sockaddr_in consock;        /* socket used by connect        */         
  3314.  int                bindsocklen;    /* size of bind socket           */         
  3315.  int                consocklen;     /* size of connect socket        */         
  3316.  int                bindrc;         /* the return code from bind     */         
  3317.  int                connrc;         /* the return code from connect  */         
  3318.  int                ip_part_1;                                                  
  3319.  int                ip_part_2;                                                  
  3320.  int                ip_part_3;                                                  
  3321.  int                ip_part_4;                                                  
  3322.  char               tempdsn[L_tmpnam];                                          
  3323.                                                                                 
  3324.  if (gp->connected_to_server) {                                                 
  3325.    GGMdisc(gp);                /* Disconnect from news server */                
  3326.  }                                                                              
  3327.                                                                                 
  3328.  gp->closing_connection = FALSE;                                                
  3329.                                                                                 
  3330.  if (!*gp->ggserver) {                                                          
  3331.    ERR1(                                                                        
  3332.   "No host server defined in Gopher menu,  Cannot make a connection."           
  3333.        );                                                                       
  3334.    return FALSE;                                                                
  3335.  }                                                                              
  3336.                                                                                 
  3337.  uppercase_in_place(gp->ggserver);                                              
  3338.                                                                                 
  3339.  /* If server is "local hack", then establish local mode,                       
  3340.   * open temporary file and return.                                             
  3341.   */                                                                            
  3342.                                                                                 
  3343.  if (!strcmp(gp->ggserver, LOCAL_HOST_FROB)) {                                  
  3344.                                                                                 
  3345.    if (gp->ginfo->port != GOPHER_PORT_NUMBER) {                                 
  3346.      ERR3("Server name %s is permitted only with port number %d.",              
  3347.           LOCAL_HOST_FROB, GOPHER_PORT_NUMBER);                                 
  3348.      return FALSE;                                                              
  3349.    }                                                                            
  3350.                                                                                 
  3351.    GETMAIN(gp->recvp,struct recvstruct, 1, "local recv struct");                
  3352.    if (!gp->recvp) {                                                            
  3353.      CRIT1("Can't get memory for local host struct");                           
  3354.      return FALSE;                                                              
  3355.    }                                                                            
  3356.    R = gp->recvp;                                                               
  3357.    memset(R,0,sizeof(struct recvstruct));                                       
  3358.                                                                                 
  3359.    if (!tmpnam(tempdsn)) {                                                      
  3360.      CRIT1("Can't create temporary file for local access");                     
  3361.      return FALSE;                                                              
  3362.    }                                                                            
  3363.                                                                                 
  3364.    /* Create temporary file for writing and reading. */                         
  3365.                                                                                 
  3366.    R->outfp = fopen(tempdsn,"w+,type=memory");                                  
  3367.    if (!R->outfp) {                                                             
  3368.      perror(tempdsn);                                                           
  3369.      CRIT1("Can't open temporary file for local access");                       
  3370.      return FALSE;                                                              
  3371.    }                                                                            
  3372.                                                                                 
  3373.    gp->connected_to_server = TRUE;                                              
  3374.    gp->time_to_go_home     = FALSE;                                             
  3375.    gp->connection_broken   = FALSE;                                             
  3376.                                                                                 
  3377.    GGMesrvr(gp);                                                                
  3378.                                                                                 
  3379.    return TRUE;                                                                 
  3380.  }                                                                              
  3381.                                                                                 
  3382.  /* Disallow network connections if started up in local mode. */                
  3383.                                                                                 
  3384.  if (gp->local_mode) {                                                          
  3385.    ERR1("Network connections are not allowed in local mode.");                  
  3386.    return FALSE;                                                                
  3387.  }                                                                              
  3388.                                                                                 
  3389.  /* Determine the local path name. Do only if making net conn. */               
  3390.                                                                                 
  3391.  if (!*gp->client_hostname) {                                                   
  3392.                                                                                 
  3393.    if (!get_client_hostname(gp)) return FALSE;                                  
  3394.                                                                                 
  3395.  }                                                                              
  3396.                                                                                 
  3397.  /* Get server name and address.  */                                            
  3398.                                                                                 
  3399.  if (strchr(gp->ggserver,'.') &&                                                
  3400.      gp->ggserver[strspn(gp->ggserver,".0123456789")] == '\0') {                
  3401.    ip_part_1 = ip_part_2 = ip_part_3 = ip_part_4 = 32767;                       
  3402.    strcpy(gp->server_hostname, gp->ggserver);                                   
  3403.    sscanf(gp->ggserver,"%d.%d.%d.%d",&ip_part_1,                                
  3404.                                      &ip_part_2,                                
  3405.                                      &ip_part_3,                                
  3406.                                      &ip_part_4);                               
  3407.    if (ip_part_1 > 255 ||                                                       
  3408.        ip_part_2 > 255 ||                                                       
  3409.        ip_part_3 > 255 ||                                                       
  3410.        ip_part_4 > 255) {                                                       
  3411.      ERR2("Syntax error in server network address: %s", gp->ggserver);          
  3412.      return FALSE;                                                              
  3413.    }                                                                            
  3414.    gp->server_ip_address = (IPADDRESS) ((ip_part_1 << 24) +                     
  3415.                                         (ip_part_2 << 16) +                     
  3416.                                         (ip_part_3 <<  8) +                     
  3417.                                         (ip_part_4      ));                     
  3418.  }                                                                              
  3419.  else {                                                                         
  3420.    server_hp = gethostbyname(gp->ggserver);                                     
  3421.    if (!server_hp) {                                                            
  3422.      ERR2(                                                                      
  3423. "Unknown host %s - gethostbyname() could not resolve the server name.",         
  3424.           gp->ggserver);                                                        
  3425.      return FALSE;                                                              
  3426.    }                                                                            
  3427.    strcpy(gp->server_hostname, server_hp->h_name);                              
  3428.    gp->server_ip_address = *(IPADDRESS *)server_hp->h_addr;                     
  3429.  }                                                                              
  3430.                                                                                 
  3431.  format_ip_address(gp->server_ip_address, gp->server_ip_addrstr);               
  3432.  format_ip_address(gp->client_ip_address, gp->client_ip_addrstr);               
  3433.                                                                                 
  3434.  (void)GGMivput(gp,"GGSERVER ",gp->ggserver,-1);                                
  3435.  (void)GGMivput(gp,"GGSERVIP ",gp->server_ip_addrstr,-1);                       
  3436.  (void)GGMivput(gp,"GGCLIENT ",gp->ggclient,-1);                                
  3437.  (void)GGMivput(gp,"GGCLIEIP ",gp->client_ip_addrstr,-1);                       
  3438.                                                                                 
  3439.  consock.sin_family       = AF_INET;                                            
  3440.  consock.sin_port         = htons(gp->ginfo->port);                             
  3441.  consock.sin_addr.s_addr  = gp->server_ip_address;                              
  3442.                                                                                 
  3443.  bindsock.sin_family      = AF_INET;                                            
  3444.  bindsock.sin_port        = 0;                                                  
  3445. #ifdef SNSTCPIP                                                                 
  3446.  bindsock.sin_addr.s_addr = INADDR_ANY;                                         
  3447. #else                                                                           
  3448.  bindsock.sin_addr.s_addr = gp->client_ip_address;                              
  3449. #endif                                                                          
  3450.                                                                                 
  3451.  gp->socknum = socket(AF_INET, SOCK_STREAM, 0);                                 
  3452.  if (gp->socknum < 0) {                                                         
  3453.    REPORT_TCP_ERROR(gp->ggserver);                                              
  3454.    ERR2("TCP/IP error: socket() failed to make socket for server %s.",          
  3455.         gp->ggserver);                                                          
  3456.    return FALSE;                                                                
  3457.  }                                                                              
  3458.                                                                                 
  3459.  bindsocklen = sizeof(bindsock);                                                
  3460.  bindrc = Bind(gp->socknum, &bindsock, bindsocklen);                            
  3461.  if (bindrc < 0) {                                                              
  3462.    REPORT_TCP_ERROR(gp->ggserver);                                              
  3463.    ERR2("TCP/IP error: bind() failed to bind socket for server %s.",            
  3464.         gp->ggserver);                                                          
  3465.    return FALSE;                                                                
  3466.  }                                                                              
  3467.                                                                                 
  3468.  (void)GGMispf(gp,"CONTROL DISPLAY LOCK");                                      
  3469.  (void)GGMispf(gp,"DISPLAY PANEL(GGMLCONN)");                                   
  3470.                                                                                 
  3471.  if (gp->debug_file) {                                                          
  3472.    fprintf(gp->debug_file,                                                      
  3473.            "Client %s (%s) connecting to GOPHER server on %s (%s)\n",           
  3474.            gp->client_hostname,                                                 
  3475.            gp->client_ip_addrstr,                                               
  3476.            gp->server_hostname,                                                 
  3477.            gp->server_ip_addrstr);                                              
  3478.  }                                                                              
  3479.                                                                                 
  3480.  consocklen = sizeof(consock);                                                  
  3481.  connrc = Connect(gp->socknum, &consock, consocklen);                           
  3482.                                                                                 
  3483.  if (connrc < 0) {                                                              
  3484.    REPORT_TCP_ERROR(gp->ggserver);                                              
  3485.    ERR2("TCP/IP failure: connect() failed to connect to server %s.",            
  3486.         gp->ggserver);                                                          
  3487.    return FALSE;                                                                
  3488.  }                                                                              
  3489.                                                                                 
  3490.  gp->connected_to_server = TRUE;                                                
  3491.  gp->time_to_go_home     = FALSE;                                               
  3492.  gp->connection_broken   = FALSE;                                               
  3493.                                                                                 
  3494.  /* Clean up any stray responses from server. */                                
  3495.                                                                                 
  3496.  GGMesrvr(gp);                             /* End server read */                
  3497.                                                                                 
  3498.  return TRUE;                                                                   
  3499.                                                                                 
  3500. }                                                                               
  3501.                                                                                 
  3502. ./   ADD NAME=GGMCSO,SSI=01000040                                               
  3503.                                                                                 
  3504.  /********************************************************************/         
  3505.  /*                                                                  */         
  3506.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3507.  /*                                                                  */         
  3508.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3509.  /*                                                                  */         
  3510.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3511.  /* including the implied warranties of merchantability and fitness, */         
  3512.  /* are expressly denied.                                            */         
  3513.  /*                                                                  */         
  3514.  /* Provided this copyright notice is included, this software may    */         
  3515.  /* be freely distributed and not offered for sale.                  */         
  3516.  /*                                                                  */         
  3517.  /* Changes or modifications may be made and used only by the maker  */         
  3518.  /* of same, and not further distributed.  Such modifications should */         
  3519.  /* be mailed to the author for consideration for addition to the    */         
  3520.  /* software and incorporation in subsequent releases.               */         
  3521.  /*                                                                  */         
  3522.  /********************************************************************/         
  3523.                                                                                 
  3524. #pragma  csect(code,  "GG@CSO")                                                 
  3525. #pragma  csect(static,"GG$CSO")                                                 
  3526. #include "gg.h"                                                                 
  3527.                                                                                 
  3528. /****** Gopher CSO interface. ************************************/             
  3529.                                                                                 
  3530. Bool                                                                            
  3531. GGMcso(gp,ip,as_file)                                                           
  3532. Rstruc ggcb        *gp;                                                         
  3533. Rstruc gopherinfo  *ip;                                                         
  3534. Fool                as_file;        /* ignored */                               
  3535. {                                                                               
  3536.  char              *lp;                                                         
  3537.  Bool               got_some;                                                   
  3538.  char               ggcsoq[256];                                                
  3539.  int                e_index_i;                                                  
  3540.  char               e_index_c[10];                                              
  3541.  char               sep[80] =                                                   
  3542.                               "--------------------";                           
  3543.                                                                                 
  3544.  strcpy(gp->ggserver,ip->host);     /* Specify server to connect to */          
  3545.                                                                                 
  3546.  strcpy(ggcsoq,"");                                                             
  3547.                                                                                 
  3548.  GGMispf(gp,"VGET (GGCSOQ) PROFILE");                                           
  3549.                                                                                 
  3550.  if (GGMdispl(gp,"GGMPCSO ") > 0) return FALSE;                                 
  3551.                                                                                 
  3552.  GGMivget(gp,"GGCSOQ ",ggcsoq, sizeof(ggcsoq));                                 
  3553.                                                                                 
  3554.  /***** set up query command to server ****** start ******************/         
  3555.                                                                                 
  3556.  strcpy(gp->gopher_command,"query ");                                           
  3557.  if (!*ip->path)                                                                
  3558.      strcpy(gp->gopher_command + 6, ggcsoq);                                    
  3559.  else                                                                           
  3560.      sprintf(gp->gopher_command + 6,"%s\t%s",ip->path,ggcsoq);                  
  3561.  strcat(gp->gopher_command," return all");                                      
  3562.                                                                                 
  3563.  /***** set up query command to server ****** end   ******************/         
  3564.                                                                                 
  3565.  gp->ginfo = ip;                                                                
  3566.  gp->receiving_text = FALSE;                                                    
  3567.                                                                                 
  3568.  if (!GGMconn(gp)) return FALSE;   /* Connect to gopher server      */          
  3569.                                                                                 
  3570.  if (!GGMsockt(gp)) return FALSE;  /* Send socket command to server */          
  3571.                                                                                 
  3572.  GGMclrtx(gp,ip);                  /* Clear text */                             
  3573.                                                                                 
  3574.  gp->receiving_text = TRUE;                                                     
  3575.  got_some = FALSE;                                                              
  3576.  e_index_i = 2;                                                                 
  3577.  sprintf(e_index_c,":%u:",e_index_i);                                           
  3578.  do {                                                                           
  3579.    if (GGMgsrvl(gp,&lp,FALSE)) {          /* Get server line */                 
  3580.      if (lp) {                                                                  
  3581.        if (strstr(lp,e_index_c) != NULL) { /* if new entry */                   
  3582.          (void)GGMouttx(gp,sep,ip);        /* Output separator */               
  3583.          ++e_index_i;                      /* Increment index  */               
  3584.          sprintf(e_index_c,":%u:",e_index_i);                                   
  3585.        }                                                                        
  3586.        got_some = TRUE;                                                         
  3587.        (void)GGMouttx(gp,lp,ip);          /* Output text line */                
  3588.        if (lp[0] != '-' && strncmp(lp,"200",3) >= 0) break;                     
  3589.      }                                                                          
  3590.    }                                                                            
  3591.  } while (lp);                            /* until no more lines */             
  3592.                                                                                 
  3593.  if (!got_some) {                                                               
  3594.    WARN2("No data available from server %s.\n",gp->ggserver);                   
  3595.    return FALSE;                                                                
  3596.  }                                                                              
  3597.                                                                                 
  3598.  /* Send quit command        */                                                 
  3599.                                                                                 
  3600.  gp->receiving_text = FALSE;                                                    
  3601.                                                                                 
  3602.  strcpy(gp->gopher_command,"quit");                                             
  3603.                                                                                 
  3604.  if (!GGMsockt(gp)) return FALSE;  /* Send socket command to server */          
  3605.                                                                                 
  3606.  /* Read Bye message         */                                                 
  3607.                                                                                 
  3608.  gp->receiving_text = TRUE;                                                     
  3609.                                                                                 
  3610.  (void)GGMgsrvl(gp,&lp,FALSE);            /* Get server line */                 
  3611.                                                                                 
  3612.  if (gp->connected_to_server) {                                                 
  3613.    (void)GGMdisc(gp);              /* Disconnect from gopher server */          
  3614.  }                                                                              
  3615.                                                                                 
  3616.  GGMvtx(gp,ip,as_file);  /* display text from CSO server */                     
  3617.                                                                                 
  3618.  return TRUE;                                                                   
  3619.                                                                                 
  3620. }                                                                               
  3621.                                                                                 
  3622. ./   ADD NAME=GGMDFAIL,SSI=01000005                                             
  3623.                                                                                 
  3624.  /********************************************************************/         
  3625.  /*                                                                  */         
  3626.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3627.  /*                                                                  */         
  3628.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3629.  /*                                                                  */         
  3630.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3631.  /* including the implied warranties of merchantability and fitness, */         
  3632.  /* are expressly denied.                                            */         
  3633.  /*                                                                  */         
  3634.  /* Provided this copyright notice is included, this software may    */         
  3635.  /* be freely distributed and not offered for sale.                  */         
  3636.  /*                                                                  */         
  3637.  /* Changes or modifications may be made and used only by the maker  */         
  3638.  /* of same, and not further distributed.  Such modifications should */         
  3639.  /* be mailed to the author for consideration for addition to the    */         
  3640.  /* software and incorporation in subsequent releases.               */         
  3641.  /*                                                                  */         
  3642.  /********************************************************************/         
  3643.                                                                                 
  3644. #pragma  csect(code,  "GG@DFAIL")                                               
  3645. #pragma  csect(static,"GG$DFAIL")                                               
  3646. #include "gg.h"                                                                 
  3647.                                                                                 
  3648. /****** Retrieve allocation failure messages. ************************/         
  3649.                                                                                 
  3650. void                                                                            
  3651. GGMdfail(rc,p99)                                                                
  3652. int            rc;                                                              
  3653. __S99parms    *p99;                                                             
  3654. {                                                                               
  3655.  int           zero = 0;                                                        
  3656.  unsigned int  dfid = 0x40320000;                                               
  3657.  struct {                                                                       
  3658.          short first_level_msg_len;                                             
  3659.          short first_level_msg_offset;                                          
  3660.          char  first_level_msg[251];                                            
  3661.          short second_level_msg_len;                                            
  3662.          short second_level_msg_offset;                                         
  3663.          char  second_level_msg[251];                                           
  3664.         }      dfbuffer;                                                        
  3665.                                                                                 
  3666.  static int (*ikjeff18_pointer)() = NULL;                                       
  3667.                                                                                 
  3668. #ifndef FETCH                                                                   
  3669.  extern int *ikjeff18();                                                        
  3670. #endif                                                                          
  3671.                                                                                 
  3672.  if (!ikjeff18_pointer) {                                                       
  3673. #ifdef FETCH                                                                    
  3674.    ikjeff18_pointer = (int (*)())fetch("IKJEFF18");                             
  3675. #else                                                                           
  3676.    ikjeff18_pointer = (int (*)())ikjeff18;                                      
  3677. #endif                                                                          
  3678.  }                                                                              
  3679.                                                                                 
  3680.  dfbuffer.first_level_msg_len = 4;                                              
  3681.  dfbuffer.second_level_msg_len = 4;                                             
  3682.                                                                                 
  3683.  if (ikjeff18_pointer) {                                                        
  3684.    if ((*ikjeff18_pointer)(p99,&rc,&zero,&dfid,&zero,&dfbuffer)) {              
  3685.      fprintf(stderr,"IKJEFF18 returned a nonzero return code\n");               
  3686.    }                                                                            
  3687.    if (dfbuffer.first_level_msg_len > 0) {                                      
  3688.      fprintf(stderr,"%*.*s\n",                                                  
  3689.                     dfbuffer.first_level_msg_len-4,                             
  3690.                     dfbuffer.first_level_msg_len-4,                             
  3691.                     dfbuffer.first_level_msg);                                  
  3692.    }                                                                            
  3693.    if (dfbuffer.second_level_msg_len > 0) {                                     
  3694.      fprintf(stderr,"%*.*s\n",                                                  
  3695.                     dfbuffer.second_level_msg_len-4,                            
  3696.                     dfbuffer.second_level_msg_len-4,                            
  3697.                     dfbuffer.second_level_msg);                                 
  3698.    }                                                                            
  3699.  }                                                                              
  3700.  else {                                                                         
  3701. #ifdef FETCH                                                                    
  3702.    fprintf(stderr,"GGMVS: Cannot fetch IKJEFF18\n");                            
  3703. #else                                                                           
  3704.    fprintf(stderr,"Cannot call IKJEFF18, not linked with GGMVS\n");             
  3705. #endif                                                                          
  3706.  }                                                                              
  3707.  return;                                                                        
  3708. }                                                                               
  3709.                                                                                 
  3710. ./   ADD NAME=GGMDIR,SSI=012B0041                                               
  3711.                                                                                 
  3712.  /********************************************************************/         
  3713.  /*                                                                  */         
  3714.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  3715.  /*                                                                  */         
  3716.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  3717.  /*                                                                  */         
  3718.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  3719.  /* including the implied warranties of merchantability and fitness, */         
  3720.  /* are expressly denied.                                            */         
  3721.  /*                                                                  */         
  3722.  /* Provided this copyright notice is included, this software may    */         
  3723.  /* be freely distributed and not offered for sale.                  */         
  3724.  /*                                                                  */         
  3725.  /* Changes or modifications may be made and used only by the maker  */         
  3726.  /* of same, and not further distributed.  Such modifications should */         
  3727.  /* be mailed to the author for consideration for addition to the    */         
  3728.  /* software and incorporation in subsequent releases.               */         
  3729.  /*                                                                  */         
  3730.  /********************************************************************/         
  3731.                                                                                 
  3732. #pragma  csect(code,  "GG@DIR  ")                                               
  3733. #pragma  csect(static,"GG$DIR  ")                                               
  3734. #include "gg.h"                                                                 
  3735.                                                                                 
  3736. /*********************************************************************/         
  3737.                                                                                 
  3738. static Bool                                                                     
  3739. valid_code(c)                                                                   
  3740. char       c;                                                                   
  3741. {                                                                               
  3742.                                                                                 
  3743.  switch (c) {                                                                   
  3744.    case GOPHER_FILE:                                                            
  3745.    case GOPHER_DIRECTORY:                                                       
  3746.    case GOPHER_TELNET:                                                          
  3747.    case GOPHER_TN3270:                                                          
  3748.    case GOPHER_WAIS:                                                            
  3749.    case GOPHER_WHOIS:                                                           
  3750.    case GOPHER_CSO:                                                             
  3751.                            return TRUE;                                         
  3752.    default:                return FALSE;                                        
  3753.   }                                                                             
  3754.                                                                                 
  3755. }                                                                               
  3756.                                                                                 
  3757. /*********************************************************************/         
  3758.                                                                                 
  3759. static Bool                                                                     
  3760. process_s_selection(gp,ip)                                                      
  3761. Rstruc ggcb           *gp;                                                      
  3762. Rstruc gopherinfo     *ip;                                                      
  3763. {                                                                               
  3764.                                                                                 
  3765.  GGMgofor(gp,ip,FALSE);                                                         
  3766.                                                                                 
  3767.  return TRUE;                                                                   
  3768. }                                                                               
  3769.                                                                                 
  3770. /*********************************************************************/         
  3771.                                                                                 
  3772. static Bool                                                                     
  3773. process_e_selection(gp,ip)                                                      
  3774. Rstruc ggcb           *gp;                                                      
  3775. Rstruc gopherinfo     *ip;                                                      
  3776. {                                                                               
  3777.                                                                                 
  3778.  if (ip->thdr.first_text_line) {                                                
  3779.    GGMxtx(gp,ip);                                                               
  3780.    return TRUE;                                                                 
  3781.  }                                                                              
  3782.  else {                                                                         
  3783.    ERR1("Extract must be preceded by Select.");                                 
  3784.    return FALSE;                                                                
  3785.  }                                                                              
  3786. }                                                                               
  3787.                                                                                 
  3788. /*********************************************************************/         
  3789.                                                                                 
  3790. static Bool                                                                     
  3791. process_q_selection(gp,ip)                                                      
  3792. Rstruc ggcb           *gp;                                                      
  3793. Rstruc gopherinfo     *ip;                                                      
  3794. {                                                                               
  3795.                                                                                 
  3796.  GGMgofor(gp,ip,TRUE);                                                          
  3797.                                                                                 
  3798.  return TRUE;                                                                   
  3799. }                                                                               
  3800.                                                                                 
  3801. /*********************************************************************/         
  3802.                                                                                 
  3803. static Bool                                                                     
  3804. display_dynamic_area(gp,ip,infoarray,entrycount)                                
  3805. Rstruc ggcb           *gp;                                                      
  3806. Rstruc gopherinfo     *ip;                                                      
  3807. Rstruc gopherinfo     *infoarray;                                               
  3808. int                    entrycount;                                              
  3809. {                                                                               
  3810.  struct gopherinfo    *iap;                                                     
  3811.  int                   depth;                                                   
  3812.  int                   ggglvl;                                                  
  3813.  int                   dynsize;                                                 
  3814.  int                   topitem;                                                 
  3815.  int                   bottomitem;                                              
  3816.  int                   last_item_selected;                                      
  3817.  int                   dti;                                                     
  3818.  int                   gii;                                                     
  3819.  int                   l;                                                       
  3820.  int                   prc;                                                     
  3821.  int                   command_index;                                           
  3822.  int                   zscrolln;                                                
  3823.  Bool                  selection_processed_ok;                                  
  3824.  Bool                  command_processed_ok;                                    
  3825.  Bool                  is_max;                                                  
  3826.  char                 *gggdyna;                                                 
  3827.  char                 *rowp;                                                    
  3828.  char                 *cp;                                                      
  3829.  char                  gggcmd     [72];                                         
  3830.  char                  zverb       [9];                                         
  3831.  char                  zscrolla    [9];                                         
  3832.  char                  command    [COMMANDSIZE];                                
  3833.  char                  ggghead    [81];                                         
  3834.  char                  rowmessage [81];                                         
  3835.                                                                                 
  3836.  /* Get depth of dynamic area (number of rows to display on screen) */          
  3837.                                                                                 
  3838.  (void)GGMispf(gp,                                                              
  3839.        "PQUERY PANEL(GGMDIR) AREANAME(GGGDYNA) DEPTH(GGGDEPTH)");               
  3840.  if (gp->ispfrc != 0) return FALSE;                                             
  3841.  depth = GGMiget(gp,"GGGDEPTH ");                                               
  3842.                                                                                 
  3843.  /* Get storage for ISPF dynamic area variable to be constructed. */            
  3844.                                                                                 
  3845.  dynsize = 80*depth;                                                            
  3846.  GETMAIN(gggdyna, char, dynsize+1, "GGGDYNA buffer");                           
  3847.  if (!gggdyna) return FALSE;                                                    
  3848.                                                                                 
  3849.  /* Loop displaying the panel until END pressed. */                             
  3850.                                                                                 
  3851.  topitem = 0;                                                                   
  3852.  last_item_selected = -1;                                                       
  3853.  strcpy(gggcmd,"");                                                             
  3854.                                                                                 
  3855.  do {                                                                           
  3856.                                                                                 
  3857.  /* Fill in the dynamic area with rows, one for each gopher item. */            
  3858.                                                                                 
  3859.    memset(gggdyna,' ',dynsize);                                                 
  3860.                                                                                 
  3861.    for (dti = 0,       gii = topitem,     rowp = gggdyna;                       
  3862.         dti < depth && gii < entrycount;                                        
  3863.         dti++,         gii++,             rowp += 80) {                         
  3864.      iap = &infoarray[gii];                                                     
  3865.      rowp[ 0] = DATAIN_HIGH;             /* selection code attribute */         
  3866.      rowp[ 1] = ' ';                     /* selection code field     */         
  3867.      rowp[ 2] = DATAOUT_GREEN;           /* icon attribute           */         
  3868.      memcpy(&rowp[ 3],GGMtype(iap->type),9);                                    
  3869.      rowp[12] = DATAOUT_HIGH;            /* description attribute    */         
  3870.      l = strlen(iap->desc);                                                     
  3871.      memcpy(&rowp[13],iap->desc,l > 67 ? 67 : l);                               
  3872.    }                                                                            
  3873.                                                                                 
  3874.    if (rowp < gggdyna + dynsize) {                                              
  3875.      rowp[0] = DATAOUT_HIGH;                                                    
  3876.      memset(&rowp[1], '-',79);                                                  
  3877.    }                                                                            
  3878.                                                                                 
  3879.    bottomitem = gii - 1;                                                        
  3880.                                                                                 
  3881.    if (topitem > bottomitem) strcpy(rowmessage,"");                             
  3882.    else sprintf(rowmessage, " %d-%d of %d",                                     
  3883.                        topitem + 1, bottomitem + 1, entrycount);                
  3884.                                                                                 
  3885.    memset(ggghead,' ',79);                                                      
  3886.    ggghead[79] = '\0';                                                          
  3887.    strcpy(ggghead,"GOPHER - ");                                                 
  3888.    strncpy(ggghead+9,ip->desc,70);                                              
  3889.    *strchr(ggghead,'\0') = ' ';                                                 
  3890.    memcpy(ggghead+79-strlen(rowmessage),rowmessage,strlen(rowmessage));         
  3891.                                                                                 
  3892.    (void)GGMivput(gp,"GGGHEAD ",ggghead,79);                                    
  3893.    (void)GGMivput(gp,"GGGDYNA ",gggdyna, dynsize);                              
  3894.    (void)GGMivput(gp,"GGGCMD " ,gggcmd,  -1);                                   
  3895.                                                                                 
  3896.    prc = GGMdispl(gp,"GGMDIR  ");                                               
  3897.    if (prc > 8) break;                                                          
  3898.                                                                                 
  3899.    (void)GGMivget(gp,"GGGDYNA " , gggdyna,  dynsize);                           
  3900.    (void)GGMivget(gp,"ZVERB "   , zverb,    sizeof(zverb));                     
  3901.    (void)GGMivget(gp,"ZSCROLLA ", zscrolla, sizeof(zscrolla));                  
  3902.    zscrolln = GGMiget(gp,"ZSCROLLN ");                                          
  3903.    ggglvl   = GGMiget(gp,"GGGLVL ");                                            
  3904.    last_item_selected = -1;                                                     
  3905.                                                                                 
  3906.    /* Process selections. */                                                    
  3907.                                                                                 
  3908.    for (gii = topitem,         rowp = gggdyna;                                  
  3909.         gii <= bottomitem;                                                      
  3910.         gii++,                 rowp += 80) {                                    
  3911.      iap = &infoarray[gii];                                                     
  3912.      switch (rowp[1]) {                                                         
  3913.        case ' ':  continue;                                                     
  3914.        case 's':                                                                
  3915.        case 'S':  selection_processed_ok = process_s_selection(gp,iap);         
  3916.                   break;                                                        
  3917.        case 'e':                                                                
  3918.        case 'E':  selection_processed_ok = process_e_selection(gp,iap);         
  3919.                   break;                                                        
  3920.        case 'q':                                                                
  3921.        case 'Q':  selection_processed_ok = process_q_selection(gp,iap);         
  3922.                   break;                                                        
  3923.        default:                                                                 
  3924.         ERR1("Unknown selection code.  Type one of the listed codes.");         
  3925.                   selection_processed_ok = FALSE;                               
  3926.                   break;                                                        
  3927.      }                                                                          
  3928.      if (selection_processed_ok) last_item_selected = gii;                      
  3929.      if (gp->quit) break;                                                       
  3930.    }                                                                            
  3931.                                                                                 
  3932.    /* Process command if any. */                                                
  3933.                                                                                 
  3934.    strcpy(gggcmd,"");                                                           
  3935.                                                                                 
  3936.    (void)GGMivget(gp,"GGGCMD ",gggcmd,sizeof(gggcmd));                          
  3937.                                                                                 
  3938.    if (*gggcmd) {                                                               
  3939.                                                                                 
  3940.      memset(command,' ',COMMANDSIZE);                                           
  3941.      command_index = 0;                                                         
  3942.      for (cp = gggcmd; *cp && !isspace(*cp); cp++) {                            
  3943.        if (cp >= gggcmd+COMMANDSIZE) {                                          
  3944.          ERR1("Invalid command name.");                                         
  3945.          command_processed_ok = FALSE;                                          
  3946.        }                                                                        
  3947.        command[command_index++] = toupper(*cp);                                 
  3948.      }                                                                          
  3949.      while (*cp && isspace(*cp)) cp++;                                          
  3950.                                                                                 
  3951.      if (memcmp(command,"QUIT    ",8) == 0) {                                   
  3952.        gp->quit = TRUE;                                                         
  3953.      }                                                                          
  3954.      else {                                                                     
  3955.        ERR2("Unknown command name: %8.8s",command);                             
  3956.      }                                                                          
  3957.      command_processed_ok = FALSE;                                              
  3958.                                                                                 
  3959.      if (command_processed_ok) strcpy(gggcmd,"");                               
  3960.                                                                                 
  3961.    }                                                                            
  3962.                                                                                 
  3963.    if (gp->quit) break;                                                         
  3964.                                                                                 
  3965.    if (last_item_selected >= 0 && gp->autoscroll) {                             
  3966.      topitem = last_item_selected;                                              
  3967.    }                                                                            
  3968.                                                                                 
  3969.    /* Process scroll request if any. */                                         
  3970.                                                                                 
  3971.    is_max = EQUAL(zscrolla,"MAX");                                              
  3972.    if      (EQUAL(zverb,"DOWN")) {                                              
  3973.      if (is_max) topitem = entrycount - ggglvl;                                 
  3974.      else        topitem += zscrolln;                                           
  3975.    }                                                                            
  3976.    else if (EQUAL(zverb,"UP")) {                                                
  3977.      if (is_max) topitem = 0;                                                   
  3978.      else        topitem -= zscrolln;                                           
  3979.    }                                                                            
  3980.    else if (EQUAL(zverb,"RETURN")) {                                            
  3981.      gp->quit = TRUE;                                                           
  3982.      break;                                                                     
  3983.    }                                                                            
  3984.    if (topitem < 0)                                                             
  3985.        topitem = 0;                                                             
  3986.    if (topitem > entrycount)                                                    
  3987.        topitem = entrycount;                                                    
  3988.                                                                                 
  3989.  } while (prc == 0);                                                            
  3990.                                                                                 
  3991.  return;                                                                        
  3992.                                                                                 
  3993. }                                                                               
  3994.                                                                                 
  3995. /****** Gopher a directory. ******************************************/         
  3996.                                                                                 
  3997. Bool                                                                            
  3998. GGMdir(gp,ip,as_file)                                                           
  3999. Rstruc ggcb        *gp;                                                         
  4000. Rstruc gopherinfo  *ip;                                                         
  4001. Fool                as_file;                                                    
  4002. {                                                                               
  4003.  int                entrycount;                                                 
  4004.  int                i;                                                          
  4005.  int                copysize;                                                   
  4006.  char               typechar;                                                   
  4007.  char               savechar;                                                   
  4008.  char              *p;                                                          
  4009.  char              *q;                                                          
  4010.  char              *r;                                                          
  4011.  struct textline   *tp;                                                         
  4012.  struct gopherinfo *infoarray;                                                  
  4013.  struct gopherinfo *iap;                                                        
  4014.  char               temp[16];                                                   
  4015.                                                                                 
  4016.  if (as_file) {                                                                 
  4017.    GGMvtx(gp,ip,as_file);  /* if as a file, display text as is */               
  4018.    return TRUE;                                                                 
  4019.  }                                                                              
  4020.                                                                                 
  4021.  /* The text chain contains the data from the server, which should be           
  4022.   * in the following format:                                                    
  4023.   *                                                                             
  4024.   * nDescription^Path^foo^bar                                                   
  4025.   *                                                                             
  4026.   * where the "n" in the beginning is a digit and ^ means a tab char.           
  4027.   *                                                                             
  4028.   * Logic:                                                                      
  4029.   *                                                                             
  4030.   * Build an array of gopherinfo structs from the text records.                 
  4031.   *                                                                             
  4032.   * Display them as an ISPF dynamic area pseudotable.                           
  4033.   *                                                                             
  4034.   * Let the user select them, and run GGMgofor on each one                      
  4035.   * with a struct gopherinfo built from the contents.                           
  4036.   *                                                                             
  4037.   */                                                                            
  4038.                                                                                 
  4039.  /* Determine size of array of gopherinfo structs.  This is equal to            
  4040.   * the number of text records with a valid code in the first byte.             
  4041.   */                                                                            
  4042.                                                                                 
  4043.  entrycount = 0;                                                                
  4044.  for (tp = ip->thdr.first_text_line; tp; tp = tp->next) {                       
  4045.    if (valid_code(tp->text[0])) entrycount++;                                   
  4046.  }                                                                              
  4047.                                                                                 
  4048.  if (entrycount == 0) {                                                         
  4049.    ERR1("There seems to be no information in this directory.\n");               
  4050.    return FALSE;                                                                
  4051.  }                                                                              
  4052.                                                                                 
  4053.  /* Allocate an array of structs to hold the stuff. */                          
  4054.                                                                                 
  4055.  GETMAIN(infoarray, struct gopherinfo, entrycount,"gopherinfo array");          
  4056.                                                                                 
  4057.  if (!infoarray) {                                                              
  4058.    ERR2("Not enough memory for %d gopher directory entries\n",                  
  4059.         entrycount);                                                            
  4060.    return FALSE;                                                                
  4061.  }                                                                              
  4062.                                                                                 
  4063.  /* Build the array entries. */                                                 
  4064.                                                                                 
  4065.  iap = infoarray;                                                               
  4066.  for (tp = ip->thdr.first_text_line; tp; tp = tp->next) {                       
  4067.    typechar = tp->text[0];                                                      
  4068.    if (valid_code(typechar)) {                                                  
  4069.      r = &tp->text[tp->text_length];                                            
  4070.      savechar = *r;                                                             
  4071.      *r = '\t';                                                                 
  4072.      memset(iap,0,sizeof(struct gopherinfo));                                   
  4073.      iap->port = GOPHER_PORT_NUMBER;                                            
  4074.      iap->type = (gophertype)typechar;                                          
  4075.      p = &tp->text[1];                                                          
  4076.      q = strchr(p,'\t');                                                        
  4077.      copysize = sizeof(iap->desc)-1;                                            
  4078.      if (copysize > q-p) copysize = q-p;                                        
  4079.      memcpy(iap->desc,p,copysize);                                              
  4080.      if (q < r) {                                                               
  4081.        p = q+1;                                                                 
  4082.        q = strchr(p,'\t');                                                      
  4083.        copysize = sizeof(iap->path)-1;                                          
  4084.        if (copysize > q-p) copysize = q-p;                                      
  4085.        memcpy(iap->path,p,copysize);                                            
  4086.        if (q < r) {                                                             
  4087.          p = q+1;                                                               
  4088.          q = strchr(p,'\t');                                                    
  4089.          copysize = sizeof(iap->host)-1;                                        
  4090.          if (copysize > q-p) copysize = q-p;                                    
  4091.          memcpy(iap->host,p,copysize);                                          
  4092.          if (q < r) {                                                           
  4093.            p = q+1;                                                             
  4094.            q = strchr(p,'\t');                                                  
  4095.            memset(temp,0,sizeof(temp));                                         
  4096.            copysize = sizeof(temp)-1;                                           
  4097.            if (copysize > q-p) copysize = q-p;                                  
  4098.            memcpy(temp,p,copysize);                                             
  4099.            iap->port = atoi(temp);                                              
  4100.          }                                                                      
  4101.        }                                                                        
  4102.      }                                                                          
  4103.      *r = savechar;                                                             
  4104.      iap++;                                                                     
  4105.    }                                                                            
  4106.  }                                                                              
  4107.                                                                                 
  4108.  if (gp->debug_mode) {                                                          
  4109.    for (iap = infoarray, i = entrycount; i > 0; iap++, i--) {                   
  4110.      fprintf(gp->debug_file,"GGMdir: type = %d\n",iap->type);                   
  4111.      fprintf(gp->debug_file,"GGMdir: port = %d\n",iap->port);                   
  4112.      fprintf(gp->debug_file,"GGMdir: path = %s\n",iap->path);                   
  4113.      fprintf(gp->debug_file,"GGMdir: host = %s\n",iap->host);                   
  4114.      fprintf(gp->debug_file,"GGMdir: desc = %s\n",iap->desc);                   
  4115.      fprintf(gp->debug_file,"\n");                                              
  4116.    }                                                                            
  4117.  }                                                                              
  4118.                                                                                 
  4119.  display_dynamic_area(gp,ip,infoarray,entrycount);                              
  4120.                                                                                 
  4121.  FREEMAIN(infoarray,"gopherinfo array");                                        
  4122.                                                                                 
  4123.  return TRUE;                                                                   
  4124. }                                                                               
  4125.                                                                                 
  4126. ./   ADD NAME=GGMDISC,SSI=01050033                                              
  4127.                                                                                 
  4128.  /********************************************************************/         
  4129.  /*                                                                  */         
  4130.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4131.  /*                                                                  */         
  4132.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4133.  /*                                                                  */         
  4134.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4135.  /* including the implied warranties of merchantability and fitness, */         
  4136.  /* are expressly denied.                                            */         
  4137.  /*                                                                  */         
  4138.  /* Provided this copyright notice is included, this software may    */         
  4139.  /* be freely distributed and not offered for sale.                  */         
  4140.  /*                                                                  */         
  4141.  /* Changes or modifications may be made and used only by the maker  */         
  4142.  /* of same, and not further distributed.  Such modifications should */         
  4143.  /* be mailed to the author for consideration for addition to the    */         
  4144.  /* software and incorporation in subsequent releases.               */         
  4145.  /*                                                                  */         
  4146.  /********************************************************************/         
  4147.                                                                                 
  4148. #pragma  csect(code,  "GG@DISC ")                                               
  4149. #pragma  csect(static,"GG$DISC ")                                               
  4150. #include "gg.h"                                                                 
  4151.                                                                                 
  4152. /****** Disconnect from gopher server. ********************************/        
  4153.                                                                                 
  4154. void                                                                            
  4155. GGMdisc(gp)                                                                     
  4156. Rstruc ggcb        *gp;                                                         
  4157. {                                                                               
  4158.  int                closerc;                                                    
  4159.  struct recvstruct *R;                                                          
  4160.                                                                                 
  4161.  /* If local mode, close temporary file and return. */                          
  4162.                                                                                 
  4163.  if ((R=gp->recvp)) {                                                           
  4164.    if (R->outfp) {                                                              
  4165.      if (fclose(R->outfp) < 0) {                                                
  4166.        CRIT1("Error closing local mode temporary file");                        
  4167.      }                                                                          
  4168.      R->outfp = NULL;                                                           
  4169.    }                                                                            
  4170.                                                                                 
  4171.    gp->connected_to_server   = FALSE;                                           
  4172.                                                                                 
  4173.    FREEMAIN(gp->recvp,"local mode recv struct");                                
  4174.    gp->recvp = NULL;                                                            
  4175.    return;                                                                      
  4176.  }                                                                              
  4177.                                                                                 
  4178.  gp->reconnect_in_progress = FALSE;                                             
  4179.  gp->closing_connection    = TRUE;                                              
  4180.                                                                                 
  4181.  if (gp->connection_broken) {                                                   
  4182.    if (gp->debug_file) {                                                        
  4183.      fprintf(gp->debug_file,                                                    
  4184.   "Client %s (%s) connection with gopher server on %s (%s) was lost\n",         
  4185.           gp->client_hostname,                                                  
  4186.           gp->client_ip_addrstr,                                                
  4187.           gp->server_hostname,                                                  
  4188.           gp->server_ip_addrstr);                                               
  4189.    }                                                                            
  4190.    gp->connected_to_server   = FALSE;                                           
  4191.  }                                                                              
  4192.  else {                                                                         
  4193.                                                                                 
  4194.    /* In case of some kind of protocol error, don't let things hang. */         
  4195.                                                                                 
  4196.    GGMesrvr(gp);         /* End server read */                                  
  4197.                                                                                 
  4198.    if (gp->debug_file) {                                                        
  4199.      fprintf(gp->debug_file,                                                    
  4200.       "Client %s (%s) disconnecting from gopher server on %s (%s)\n",           
  4201.           gp->client_hostname,                                                  
  4202.           gp->client_ip_addrstr,                                                
  4203.           gp->server_hostname,                                                  
  4204.           gp->server_ip_addrstr);                                               
  4205.    }                                                                            
  4206.                                                                                 
  4207.    (void)GGMivput(gp,"GGSOLDER ",gp->server_hostname,-1);                       
  4208.    (void)GGMivput(gp,"GGSOLDIP ",gp->server_ip_addrstr,-1);                     
  4209.    (void)GGMispf(gp,"CONTROL DISPLAY LOCK");                                    
  4210.    (void)GGMispf(gp,"DISPLAY PANEL(GGMLDISC)");                                 
  4211.                                                                                 
  4212.    /* In case of some kind of protocol error, don't let things hang. */         
  4213.                                                                                 
  4214.    GGMesrvr(gp);                   /* End server read */                        
  4215.                                                                                 
  4216.    gp->connected_to_server   = FALSE;                                           
  4217.                                                                                 
  4218.    TCP_DEBUG_ON;                                                                
  4219.    closerc = close(gp->socknum);                                                
  4220.    TCP_DEBUG_OFF;                                                               
  4221.                                                                                 
  4222.    if (closerc < 0) {                                                           
  4223.      ERR2("TCP/IP error: close() failed to disconnect from server %s.",         
  4224.           gp->ggserver);                                                        
  4225.    }                                                                            
  4226.  }                                                                              
  4227.                                                                                 
  4228.  return;                                                                        
  4229. }                                                                               
  4230.                                                                                 
  4231. ./   ADD NAME=GGMDISPL,SSI=01010001                                             
  4232.                                                                                 
  4233.  /********************************************************************/         
  4234.  /*                                                                  */         
  4235.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4236.  /*                                                                  */         
  4237.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4238.  /*                                                                  */         
  4239.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4240.  /* including the implied warranties of merchantability and fitness, */         
  4241.  /* are expressly denied.                                            */         
  4242.  /*                                                                  */         
  4243.  /* Provided this copyright notice is included, this software may    */         
  4244.  /* be freely distributed and not offered for sale.                  */         
  4245.  /*                                                                  */         
  4246.  /* Changes or modifications may be made and used only by the maker  */         
  4247.  /* of same, and not further distributed.  Such modifications should */         
  4248.  /* be mailed to the author for consideration for addition to the    */         
  4249.  /* software and incorporation in subsequent releases.               */         
  4250.  /*                                                                  */         
  4251.  /********************************************************************/         
  4252.                                                                                 
  4253.  /********************************************************************/         
  4254.                                                                                 
  4255. #pragma  csect(code,  "GG@DISPL")                                               
  4256. #pragma  csect(static,"GG$DISPL")                                               
  4257. #include "gg.h"                                                                 
  4258.                                                                                 
  4259. #ifdef FETCH                                                                    
  4260. #define VL_BIT(X) ((unsigned int)(X) | 0x80000000)                              
  4261. #else                                                                           
  4262. #define VL_BIT(X) (X)                                                           
  4263. #endif                                                                          
  4264.                                                                                 
  4265. /****** Display ISPF panel. ******************************************/         
  4266.                                                                                 
  4267. int                                                                             
  4268. GGMdispl(gp,pan8)                                                               
  4269. Rstruc ggcb    *gp;                                                             
  4270. char           *pan8;                                                           
  4271. {                                                                               
  4272.                                                                                 
  4273.  if (gp->setmsg) {                                                              
  4274.    gp->ispfrc = ISPLINK("DISPLAY ", pan8, VL_BIT("ISRZ002 "));                  
  4275.  }                                                                              
  4276.  else {                                                                         
  4277.    gp->ispfrc = ISPLINK("DISPLAY ", VL_BIT(pan8));                              
  4278.  }                                                                              
  4279.                                                                                 
  4280.  if (gp->ispfrc > 8) GGMierr(gp);   /* display ISPF error */                    
  4281.                                                                                 
  4282.  gp->setmsg = FALSE;                                                            
  4283.                                                                                 
  4284.  return gp->ispfrc;                                                             
  4285. }                                                                               
  4286.                                                                                 
  4287. ./   ADD NAME=GGMDUMP,SSI=01000036                                              
  4288.                                                                                 
  4289.  /********************************************************************/         
  4290.  /*                                                                  */         
  4291.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4292.  /*                                                                  */         
  4293.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4294.  /*                                                                  */         
  4295.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4296.  /* including the implied warranties of merchantability and fitness, */         
  4297.  /* are expressly denied.                                            */         
  4298.  /*                                                                  */         
  4299.  /* Provided this copyright notice is included, this software may    */         
  4300.  /* be freely distributed and not offered for sale.                  */         
  4301.  /*                                                                  */         
  4302.  /* Changes or modifications may be made and used only by the maker  */         
  4303.  /* of same, and not further distributed.  Such modifications should */         
  4304.  /* be mailed to the author for consideration for addition to the    */         
  4305.  /* software and incorporation in subsequent releases.               */         
  4306.  /*                                                                  */         
  4307.  /********************************************************************/         
  4308.                                                                                 
  4309. #pragma  csect(code,  "GG@DUMP ")                                               
  4310. #pragma  csect(static,"GG$DUMP ")                                               
  4311. #include "gg.h"                                                                 
  4312.                                                                                 
  4313. /****** Dump some data. **********************************************/         
  4314.                                                                                 
  4315. void                                                                            
  4316. GGMdump(struct ggcb *gp, char *label, char *p,int r)                            
  4317. {                                                                               
  4318.  int i;                                                                         
  4319.                                                                                 
  4320.  if (!gp->debug_file) return;                                                   
  4321.                                                                                 
  4322.  if (r == -2) {                                                                 
  4323.    fprintf(gp->debug_file,"%s:  %d\n",label,(int)p);                            
  4324.    return;                                                                      
  4325.  }                                                                              
  4326.                                                                                 
  4327.  if (r == -1) r = strlen(p);                                                    
  4328.                                                                                 
  4329.  fprintf(gp->debug_file,"%s:   (%d characters)\n",label,r);                     
  4330.  for (i=0;i<77;i++) fprintf(gp->debug_file,"-");                                
  4331.  fprintf(gp->debug_file,"\n");                                                  
  4332.  for (i=0;i<r;i++) {                                                            
  4333.    char c = *(p+i);                                                             
  4334.    if (isprint(c))  fprintf(gp->debug_file,"%c",c);                             
  4335.    else             fprintf(gp->debug_file,"<0x%2.2x>",c);                      
  4336.  }                                                                              
  4337.  fprintf(gp->debug_file,"\n");                                                  
  4338.  for (i=0;i<77;i++) fprintf(gp->debug_file,"-");                                
  4339.  fprintf(gp->debug_file,"\n");                                                  
  4340.                                                                                 
  4341.  return;                                                                        
  4342.                                                                                 
  4343. }                                                                               
  4344.                                                                                 
  4345. ./   ADD NAME=GGMESRVR,SSI=01030044                                             
  4346.                                                                                 
  4347.  /********************************************************************/         
  4348.  /*                                                                  */         
  4349.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4350.  /*                                                                  */         
  4351.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4352.  /*                                                                  */         
  4353.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4354.  /* including the implied warranties of merchantability and fitness, */         
  4355.  /* are expressly denied.                                            */         
  4356.  /*                                                                  */         
  4357.  /* Provided this copyright notice is included, this software may    */         
  4358.  /* be freely distributed and not offered for sale.                  */         
  4359.  /*                                                                  */         
  4360.  /* Changes or modifications may be made and used only by the maker  */         
  4361.  /* of same, and not further distributed.  Such modifications should */         
  4362.  /* be mailed to the author for consideration for addition to the    */         
  4363.  /* software and incorporation in subsequent releases.               */         
  4364.  /*                                                                  */         
  4365.  /********************************************************************/         
  4366.                                                                                 
  4367. #pragma  csect(code,  "GG@ESRVR")                                               
  4368. #pragma  csect(static,"GG$ESRVR")                                               
  4369. #include "gg.h"                                                                 
  4370.                                                                                 
  4371. /****** End server read. *********************************************/         
  4372.                                                                                 
  4373. void                                                                            
  4374. GGMesrvr(gp)                                                                    
  4375. Rstruc ggcb  *gp;                                                               
  4376. {                                                                               
  4377.  char       *lp;                                                                
  4378.  Bool        found_more_server_data = FALSE;                                    
  4379.                                                                                 
  4380.  GGMclrtx(gp,NULL);                    /* Clear text */                         
  4381.                                                                                 
  4382.  if (gp->recvp) return;                /* Skip if non-socket */                 
  4383.                                                                                 
  4384.  do {                                                                           
  4385.                                                                                 
  4386.    if (GGMgsrvl(gp,&lp,FALSE)) {       /* Get server line */                    
  4387.      if (lp) {                                                                  
  4388.        found_more_server_data = TRUE;                                           
  4389.        (void)GGMouttx(gp,lp,NULL);     /* Output text line */                   
  4390.      }                                                                          
  4391.    }                                                                            
  4392.                                                                                 
  4393.  } while (lp);                                                                  
  4394.                                                                                 
  4395.  if (found_more_server_data) {                                                  
  4396.    ERR1(                                                                        
  4397. "More data was returned by the GOPHER server than GOPHER expected."             
  4398.        );                                                                       
  4399.    GGMvtx(gp,NULL,TRUE);              /* View text */                           
  4400.  }                                                                              
  4401.                                                                                 
  4402.  return;                                                                        
  4403. }                                                                               
  4404.                                                                                 
  4405. ./   ADD NAME=GGMFREEM,SSI=01000001                                             
  4406.                                                                                 
  4407.  /********************************************************************/         
  4408.  /*                                                                  */         
  4409.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4410.  /*                                                                  */         
  4411.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4412.  /*                                                                  */         
  4413.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4414.  /* including the implied warranties of merchantability and fitness, */         
  4415.  /* are expressly denied.                                            */         
  4416.  /*                                                                  */         
  4417.  /* Provided this copyright notice is included, this software may    */         
  4418.  /* be freely distributed and not offered for sale.                  */         
  4419.  /*                                                                  */         
  4420.  /* Changes or modifications may be made and used only by the maker  */         
  4421.  /* of same, and not further distributed.  Such modifications should */         
  4422.  /* be mailed to the author for consideration for addition to the    */         
  4423.  /* software and incorporation in subsequent releases.               */         
  4424.  /*                                                                  */         
  4425.  /********************************************************************/         
  4426.                                                                                 
  4427. #pragma  csect(code,  "GG@FREEM")                                               
  4428. #pragma  csect(static,"GG$FREEM")                                               
  4429. #include "gg.h"                                                                 
  4430.                                                                                 
  4431. /****** Free memory. *************************************************/         
  4432.                                                                                 
  4433. void                                                                            
  4434. GGMfreem(gp,stuff,whatfor)                                                      
  4435. Rstruc ggcb    *gp;                                                             
  4436. char           *stuff;                                                          
  4437. char           *whatfor;                                                        
  4438. {                                                                               
  4439.                                                                                 
  4440.  free(stuff);                                                                   
  4441.                                                                                 
  4442.  if (gp->debug_file) {                                                          
  4443.    fprintf(gp->debug_file,"GGMfreem: freed memory for %s\n", whatfor);          
  4444.  }                                                                              
  4445.  return;                                                                        
  4446.                                                                                 
  4447. }                                                                               
  4448.                                                                                 
  4449. ./   ADD NAME=GGMGETDS,SSI=01020011                                             
  4450.                                                                                 
  4451.  /********************************************************************/         
  4452.  /*                                                                  */         
  4453.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4454.  /*                                                                  */         
  4455.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4456.  /*                                                                  */         
  4457.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4458.  /* including the implied warranties of merchantability and fitness, */         
  4459.  /* are expressly denied.                                            */         
  4460.  /*                                                                  */         
  4461.  /* Provided this copyright notice is included, this software may    */         
  4462.  /* be freely distributed and not offered for sale.                  */         
  4463.  /*                                                                  */         
  4464.  /* Changes or modifications may be made and used only by the maker  */         
  4465.  /* of same, and not further distributed.  Such modifications should */         
  4466.  /* be mailed to the author for consideration for addition to the    */         
  4467.  /* software and incorporation in subsequent releases.               */         
  4468.  /*                                                                  */         
  4469.  /********************************************************************/         
  4470.                                                                                 
  4471.  /********************************************************************/         
  4472.                                                                                 
  4473. #pragma  csect(code,  "GG@GETDS")                                               
  4474. #pragma  csect(static,"GG$GETDS")                                               
  4475. #include "gg.h"                                                                 
  4476.                                                                                 
  4477. #define DUMMY_FILE_POINTER_FOR_PDS  (FILE *)(-1)                                
  4478.                                                                                 
  4479. /****** Prompt user for the name of a data set to extract into. ******/         
  4480.                                                                                 
  4481. FILE *                                                                          
  4482. GGMgetds(gp,ep)                                                                 
  4483. Rstruc ggcb         *gp;                                                        
  4484. Rstruc extraction   *ep;                                                        
  4485. {                                                                               
  4486.  FILE               *xfp;                                                       
  4487.  Bool                asked_for;                                                 
  4488.  char                ggexdsn[65];    /* data set name for extraction */         
  4489.  char                ggexapp [4];    /* YES or NO for append mode    */         
  4490.  char                ggextab [4];    /* YES or NO for tab expansion  */         
  4491.  char                ggexblk [4];    /* YES or NO for blank after sep*/         
  4492.  char                ggexsep[81];    /* Separator line (optional)    */         
  4493.  char                ggexan1[16];    /* From article number          */         
  4494.  char                ggexan2[16];    /* To   article number          */         
  4495.  char                ggexpmp [9];    /* PDS member name prefix       */         
  4496.  char                ddname  [9];                                               
  4497.  char                member  [9];                                               
  4498.  char                pdspec [32];                                               
  4499.  char                quoted_dsname [67];                                        
  4500.  char                formatted_number [11];                                     
  4501.                                                                                 
  4502.  /* Display panel asking for data set name into which to extract. */            
  4503.                                                                                 
  4504.  xfp = NULL;                                                                    
  4505.  asked_for = TRUE;                                                              
  4506.                                                                                 
  4507.  (void)GGMispf(gp,"ADDPOP");                                                    
  4508.                                                                                 
  4509.  while (xfp == NULL) {                                                          
  4510.                                                                                 
  4511.    /* Keep asking for a dsname until one works or END pressed. */               
  4512.                                                                                 
  4513.    if (GGMdispl(gp,ep->panelname) > 0) {                                        
  4514.      asked_for = FALSE;                                                         
  4515.      xfp = NULL;                                                                
  4516.      break;                                                                     
  4517.    }                                                                            
  4518.                                                                                 
  4519.    (void)GGMivget(gp,"GGEXDSN ",ggexdsn,sizeof(ggexdsn));                       
  4520.    (void)GGMivget(gp,"GGEXTAB ",ggextab,sizeof(ggextab));                       
  4521.    (void)GGMivget(gp,"GGEXAN1 ",ggexan1,sizeof(ggexan1));                       
  4522.    (void)GGMivget(gp,"GGEXAN2 ",ggexan2,sizeof(ggexan2));                       
  4523.    if (ep->mode == PDS) {                                                       
  4524.      (void)GGMivget(gp,"GGEXPMP ",ggexpmp,sizeof(ggexpmp));                     
  4525.    }                                                                            
  4526.    else {                                                                       
  4527.      (void)GGMivget(gp,"GGEXAPP ",ggexapp,sizeof(ggexapp));                     
  4528.      (void)GGMivget(gp,"GGEXBLK ",ggexblk,sizeof(ggexblk));                     
  4529.      (void)GGMivget(gp,"GGEXSEP ",ggexsep,sizeof(ggexsep));                     
  4530.    }                                                                            
  4531.                                                                                 
  4532.    if (ep->mode == PDS) {                                                       
  4533.                                                                                 
  4534.      ep->appending = FALSE;                                                     
  4535.      ep->blanking  = FALSE;                                                     
  4536.      strcpy(ep->separator,"");                                                  
  4537.      strcpy(ep->ddname,"");                                                     
  4538.      strcpy(ep->member_prefix,ggexpmp);                                         
  4539.                                                                                 
  4540.      /* Note: panel forces fully-qualified name to pass to allocate */          
  4541.                                                                                 
  4542.      /* check if the PDS already exists */                                      
  4543.                                                                                 
  4544.      if (ggexdsn[0] != '\'') {                                                  
  4545.        strcpy(quoted_dsname,"'");                                               
  4546.        strcat(quoted_dsname,ggexdsn);                                           
  4547.        strcat(quoted_dsname,"'");                                               
  4548.      }                                                                          
  4549.      else strcpy(quoted_dsname,ggexdsn);                                        
  4550.                                                                                 
  4551.      /* Check if PDS already exists. */                                         
  4552.                                                                                 
  4553.      if (gp->warn_overwrite) {                                                  
  4554.        xfp = fopen(quoted_dsname,"r");                                          
  4555.        if (xfp) {                                                               
  4556.          (void)fclose(xfp);                                                     
  4557.          xfp = NULL;                                                            
  4558.          if (GGMdispl(gp,"GGMPEXPW") > 0) {                                     
  4559.            WARN1("Operation cancelled, because you pressed END.");              
  4560.            break;                                                               
  4561.          }                                                                      
  4562.        }                                                                        
  4563.      }                                                                          
  4564.                                                                                 
  4565.      if (GGMalloc(ggexdsn,ep->ddname,PDS,ep->count) != PDS) {                   
  4566.        ERR2("Allocation failed for data set %s.", ggexdsn);                     
  4567.        xfp = NULL;                                                              
  4568.        continue;                                                                
  4569.      }                                                                          
  4570.      strcpy(ep->dsname,    ggexdsn);                                            
  4571.    }                                                                            
  4572.    else {                                                                       
  4573.      strcpy(ep->separator, ggexsep);                                            
  4574.      strcpy(ep->dsname,    ggexdsn);                                            
  4575.      ep->appending = (ggexapp[0] == 'Y');                                       
  4576.      ep->blanking  = (ggexblk[0] == 'Y');                                       
  4577.    }                                                                            
  4578.                                                                                 
  4579.    ep->tab_expanding = (ggextab[0] == 'Y');                                     
  4580.    if (*ggexan1) ep->from_number = atoi(ggexan1);                               
  4581.    else          ep->from_number = 0;                                           
  4582.    if (*ggexan2) ep->to_number   = atoi(ggexan2);                               
  4583.    else          ep->to_number   = INT_MAX;                                     
  4584.                                                                                 
  4585.    /* check if the dataset already exists */                                    
  4586.    /* (Wonder if this will compile.  Have fun, "cc"...) */                      
  4587.                                                                                 
  4588.    if (ep->appending ? gp->warn_append : gp->warn_overwrite) {                  
  4589.      xfp = fopen(ggexdsn,"r");                                                  
  4590.      if (xfp) {                                                                 
  4591.        (void)fclose(xfp);                                                       
  4592.        xfp = NULL;                                                              
  4593.        if (GGMdispl(gp,"GGMPEXOW") > 0) {                                       
  4594.          WARN1("Operation cancelled, because you pressed END.");                
  4595.          break;                                                                 
  4596.        }                                                                        
  4597.      }                                                                          
  4598.    }                                                                            
  4599.                                                                                 
  4600.    if (ep->mode == PDS) {                                                       
  4601.      xfp = DUMMY_FILE_POINTER_FOR_PDS;                                          
  4602.      break;                                                                     
  4603.    }                                                                            
  4604.                                                                                 
  4605.    xfp = OPEN_TEXT_FILE_FOR_WRITE_OR_APPEND(ggexdsn,ep->appending);             
  4606.                                                                                 
  4607.    if (!xfp) {                                                                  
  4608.      perror(ggexdsn);                                                           
  4609.      ERR2("Cannot open data set %s.", ep->dsname);                              
  4610.    }                                                                            
  4611.  }                                                                              
  4612.                                                                                 
  4613.  (void)GGMispf(gp,"REMPOP");                                                    
  4614.                                                                                 
  4615.  return xfp;                                                                    
  4616.                                                                                 
  4617. }                                                                               
  4618.                                                                                 
  4619. ./   ADD NAME=GGMGETM,SSI=01000052                                              
  4620.                                                                                 
  4621.  /********************************************************************/         
  4622.  /*                                                                  */         
  4623.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4624.  /*                                                                  */         
  4625.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4626.  /*                                                                  */         
  4627.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4628.  /* including the implied warranties of merchantability and fitness, */         
  4629.  /* are expressly denied.                                            */         
  4630.  /*                                                                  */         
  4631.  /* Provided this copyright notice is included, this software may    */         
  4632.  /* be freely distributed and not offered for sale.                  */         
  4633.  /*                                                                  */         
  4634.  /* Changes or modifications may be made and used only by the maker  */         
  4635.  /* of same, and not further distributed.  Such modifications should */         
  4636.  /* be mailed to the author for consideration for addition to the    */         
  4637.  /* software and incorporation in subsequent releases.               */         
  4638.  /*                                                                  */         
  4639.  /********************************************************************/         
  4640.                                                                                 
  4641. #pragma  csect(code,  "GG@GETM ")                                               
  4642. #pragma  csect(static,"GG$GETM ")                                               
  4643. #include "gg.h"                                                                 
  4644.                                                                                 
  4645. /****** Get memory. **************************************************/         
  4646.                                                                                 
  4647. void                                                                            
  4648. GGMgetm(gp,pointer,howmuch,whatfor)                                             
  4649. Rstruc ggcb    *gp;                                                             
  4650. char          **pointer;                                                        
  4651. int             howmuch;                                                        
  4652. char           *whatfor;                                                        
  4653. {                                                                               
  4654.                                                                                 
  4655.  *pointer = (char *)malloc(howmuch);                                            
  4656.                                                                                 
  4657.  if (*pointer == NULL) {                                                        
  4658.    fprintf(stderr,"GGMgetm: Cannot obtain %d bytes of memory for %s\n",         
  4659.                   howmuch,whatfor);                                             
  4660.  }                                                                              
  4661.  else if (gp->debug_file) {                                                     
  4662.    fprintf(gp->debug_file,"GGMgetm: got %d bytes of memory for %s\n",           
  4663.                            howmuch,whatfor);                                    
  4664.  }                                                                              
  4665.  return;                                                                        
  4666.                                                                                 
  4667. }                                                                               
  4668.                                                                                 
  4669. ./   ADD NAME=GGMGOFOR,SSI=011A0004                                             
  4670.                                                                                 
  4671.  /********************************************************************/         
  4672.  /*                                                                  */         
  4673.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4674.  /*                                                                  */         
  4675.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4676.  /*                                                                  */         
  4677.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4678.  /* including the implied warranties of merchantability and fitness, */         
  4679.  /* are expressly denied.                                            */         
  4680.  /*                                                                  */         
  4681.  /* Provided this copyright notice is included, this software may    */         
  4682.  /* be freely distributed and not offered for sale.                  */         
  4683.  /*                                                                  */         
  4684.  /* Changes or modifications may be made and used only by the maker  */         
  4685.  /* of same, and not further distributed.  Such modifications should */         
  4686.  /* be mailed to the author for consideration for addition to the    */         
  4687.  /* software and incorporation in subsequent releases.               */         
  4688.  /*                                                                  */         
  4689.  /********************************************************************/         
  4690.                                                                                 
  4691. #pragma  csect(code,  "GG@GOFOR")                                               
  4692. #pragma  csect(static,"GG$GOFOR")                                               
  4693. #include "gg.h"                                                                 
  4694.                                                                                 
  4695. /********************************************************************/          
  4696.                                                                                 
  4697. static Bool                                                                     
  4698. connect_to_gopher_server(gp,ip,is_cr_needed)                                    
  4699. Rstruc ggcb        *gp;                                                         
  4700. Rstruc gopherinfo  *ip;                                                         
  4701. Fool                is_cr_needed;                                               
  4702. {                                                                               
  4703.  char              *lp;                                                         
  4704.  Bool               got_some;                                                   
  4705.                                                                                 
  4706.  strcpy(gp->ggserver,ip->host);     /* Specify server to connect to */          
  4707.  strcpy(gp->gopher_command,ip->path);   /* Specify command to issue */          
  4708.  gp->ginfo = ip;                                                                
  4709.  gp->receiving_text = FALSE;                                                    
  4710.                                                                                 
  4711.  if (!GGMconn(gp)) return FALSE;   /* Connect to gopher server      */          
  4712.                                                                                 
  4713.  if (!GGMsockt(gp)) return FALSE;  /* Send socket command to server */          
  4714.                                                                                 
  4715.  GGMclrtx(gp,ip);                  /* Clear text */                             
  4716.                                                                                 
  4717.  gp->receiving_text = TRUE;                                                     
  4718.                                                                                 
  4719.  got_some = FALSE;                                                              
  4720.  do {                                                                           
  4721.    if (GGMgsrvl(gp,&lp,is_cr_needed)) {   /* Get server line */                 
  4722.      if (lp) {                                                                  
  4723.        got_some = TRUE;                                                         
  4724.        (void)GGMouttx(gp,lp,ip);          /* Output text line */                
  4725.      }                                                                          
  4726.    }                                                                            
  4727.  } while (lp);                            /* until no more lines */             
  4728.                                                                                 
  4729.  if (!got_some) {                                                               
  4730.    WARN2("No data available from server %s.\n",gp->ggserver);                   
  4731.    return FALSE;                                                                
  4732.  }                                                                              
  4733.                                                                                 
  4734.  return TRUE;                                                                   
  4735.                                                                                 
  4736. }                                                                               
  4737.                                                                                 
  4738. /****** Gopher it. ***************************************************/         
  4739.                                                                                 
  4740. Bool                                                                            
  4741. GGMgofor(gp,ip,as_file)                                                         
  4742. Rstruc ggcb        *gp;                                                         
  4743. Rstruc gopherinfo  *ip;                                                         
  4744. Fool                as_file;                                                    
  4745. {                                                                               
  4746.  Bool               con;                                                        
  4747.  Bool               cr;                                                         
  4748.  Bool             (*fun)(struct ggcb *,struct gopherinfo *,Fool);               
  4749.                                                                                 
  4750.    /* (1) send initial path string to initial host                              
  4751.     * (2) get back data from host                                               
  4752.     * (3) if it is a gopher directory, then do:                                 
  4753.     *      - display "table" of items                                           
  4754.     *      - for each item selected, call GGMgofor recursively                  
  4755.     *     else browse the file data                                             
  4756.     * (4) bye                                                                   
  4757.     */                                                                          
  4758.                                                                                 
  4759.  if (gp->debug_mode) {                                                          
  4760.    fprintf(gp->debug_file,"GGMgofor: type = %d\n",ip->type);                    
  4761.    fprintf(gp->debug_file,"GGMgofor: port = %d\n",ip->port);                    
  4762.    fprintf(gp->debug_file,"GGMgofor: path = %s\n",ip->path);                    
  4763.    fprintf(gp->debug_file,"GGMgofor: host = %s\n",ip->host);                    
  4764.    fprintf(gp->debug_file,"GGMgofor: desc = %s\n",ip->desc);                    
  4765.  }                                                                              
  4766.                                                                                 
  4767.  switch (ip->type) {                                                            
  4768.    case GOPHER_FILE:     fun = GGMvtx;   con = TRUE;  cr = TRUE; break;         
  4769.    case GOPHER_DIRECTORY:fun = GGMdir;   con = TRUE;  cr = TRUE; break;         
  4770.    case GOPHER_TELNET:   fun = GGMtnet;  con = FALSE; cr = TRUE; break;         
  4771.    case GOPHER_TN3270:   fun = GGMtnet;  con = FALSE; cr = TRUE; break;         
  4772.    case GOPHER_WAIS:     fun = GGMwais;  con = FALSE; cr = TRUE; break;         
  4773.    case GOPHER_WHOIS:    fun = GGMwhois; con = FALSE; cr = TRUE; break;         
  4774.    case GOPHER_CSO:      fun = GGMcso;   con = FALSE; cr = FALSE;break;         
  4775.    default:                                                                     
  4776.         ERR2("Sorry, access via %s not supported", GGMtype(ip->type));          
  4777.         return FALSE;                                                           
  4778.  }                                                                              
  4779.                                                                                 
  4780.  if (con) {                                                                     
  4781.    if (!connect_to_gopher_server(gp,ip,cr)) return FALSE;                       
  4782.  }                                                                              
  4783.                                                                                 
  4784.  /* Insure no connection is active once we do the real thing. */                
  4785.                                                                                 
  4786.  if (gp->connected_to_server) {                                                 
  4787.    (void)GGMdisc(gp);              /* Disconnect from gopher server */          
  4788.  }                                                                              
  4789.                                                                                 
  4790.  return (fun)(gp,ip,as_file);                                                   
  4791. }                                                                               
  4792.                                                                                 
  4793. ./   ADD NAME=GGMGSRVL,SSI=01110001                                             
  4794.                                                                                 
  4795.  /********************************************************************/         
  4796.  /*                                                                  */         
  4797.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  4798.  /*                                                                  */         
  4799.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  4800.  /*                                                                  */         
  4801.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  4802.  /* including the implied warranties of merchantability and fitness, */         
  4803.  /* are expressly denied.                                            */         
  4804.  /*                                                                  */         
  4805.  /* Provided this copyright notice is included, this software may    */         
  4806.  /* be freely distributed and not offered for sale.                  */         
  4807.  /*                                                                  */         
  4808.  /* Changes or modifications may be made and used only by the maker  */         
  4809.  /* of same, and not further distributed.  Such modifications should */         
  4810.  /* be mailed to the author for consideration for addition to the    */         
  4811.  /* software and incorporation in subsequent releases.               */         
  4812.  /*                                                                  */         
  4813.  /********************************************************************/         
  4814.                                                                                 
  4815. #pragma  csect(code,  "GG@GSRVL")                                               
  4816. #pragma  csect(static,"GG$GSRVL")                                               
  4817. #include "gg.h"                                                                 
  4818.                                                                                 
  4819. /****** Input one character from the server. *************************/         
  4820.                                                                                 
  4821. static int                                                                      
  4822. socket_getchar(gp)                                                              
  4823. Rstruc ggcb  *gp;                                                               
  4824. {                                                                               
  4825.  int         readrc;                                                            
  4826.                                                                                 
  4827.  if (gp->g_buf_index == -1 ||                                                   
  4828.      gp->g_buf_index >= gp->g_bytes_returned - 1) {                             
  4829.    gp->g_buf_index = -1;                                                        
  4830.    if (gp->dont_read) return(SOCKET_NO_MORE);                                   
  4831.    else {                                                                       
  4832.      TCP_DEBUG_ON;                                                              
  4833.      readrc = read(gp->socknum, gp->g_buf, READ_BYTES);                         
  4834.      TCP_DEBUG_OFF;                                                             
  4835.      if (readrc == -1) {                                                        
  4836.        gp->connection_broken = TRUE;                                            
  4837.        return SOCKET_GETCHAR_ERROR;                                             
  4838.      }                                                                          
  4839.      else if (readrc == 0) {                                                    
  4840.        gp->connection_broken = FALSE;                                           
  4841.        return SOCKET_READ_NOTHING;                                              
  4842.      }                                                                          
  4843.      else {                                                                     
  4844. #ifdef MVS                                                                      
  4845.        ASCII_TO_EBCDIC(gp->g_buf,readrc);                                       
  4846. #endif                                                                          
  4847.        gp->g_bytes_returned = readrc;                                           
  4848.      }                                                                          
  4849.    }                                                                            
  4850.  }                                                                              
  4851.  return gp->g_buf[++gp->g_buf_index];                                           
  4852. }                                                                               
  4853.                                                                                 
  4854. /****** Input one data line at a time from the server. ***************/         
  4855.                                                                                 
  4856. static enum socket_retval                                                       
  4857. socket_from_server(gp)                                                          
  4858. Rstruc ggcb *gp;                                                                
  4859. {                                                                               
  4860.  char       *s_buf;                                                             
  4861.  int         s_bytes;                                                           
  4862.  int         s_buf_index;                                                       
  4863.  int         character;                                                         
  4864.  int         previous_character;                                                
  4865.                                                                                 
  4866.  s_buf   = gp->server_buf;                                                      
  4867.  s_bytes = SERVER_BUF_MSGSIZE;                                                  
  4868.                                                                                 
  4869.  /* Get characters from the server until CRLF is reached. */                    
  4870.                                                                                 
  4871.  s_buf_index = 0;                                                               
  4872.  previous_character = -1;                                                       
  4873.  for (;;) {                                                                     
  4874.    character = socket_getchar(gp);                                              
  4875.    /*                                                                           
  4876.    if (character == LINE_FEED && previous_character == CARRIAGE_RETURN)         
  4877.       break;                                                                    
  4878.    */                                                                           
  4879.    if (character == LINE_FEED) break;                                           
  4880.    if (character == SOCKET_GETCHAR_ERROR)  return(SERVER_READ_ERROR);           
  4881.    if (character == SOCKET_NO_MORE)        return(SERVER_NO_MORE);              
  4882.    if (character == SOCKET_READ_NOTHING)   return(SERVER_READ_NOTHING);         
  4883.    previous_character = character;                                              
  4884.    if (s_buf_index >= s_bytes) {                                                
  4885.      fprintf(stderr,"Error: gp->server_buf overflowed.\n");                     
  4886.      fprintf(stderr,                                                            
  4887.              "More than %d bytes collected without CR/LF seen.\n",              
  4888.              s_bytes);                                                          
  4889.      if (gp->debug_file) {                                                      
  4890.        GGMdump(gp,"Data collected so far",gp->server_buf,s_bytes);              
  4891.      }                                                                          
  4892.      return(SERVER_BUFFER_ERROR);                                               
  4893.    }                                                                            
  4894.    if (character == '\0') {                                                     
  4895.      fprintf(stderr,                                                            
  4896. "Warning: null character found in data from server, changed to blank\n"         
  4897.             );                                                                  
  4898.      character = ' ';                                                           
  4899.    }                                                                            
  4900.    s_buf[s_buf_index++] = (unsigned char)character;                             
  4901.  }                                                                              
  4902.  s_buf[s_buf_index] = '\0';                                                     
  4903.  return(SERVER_READ_OK);                                                        
  4904. }                                                                               
  4905.                                                                                 
  4906. /****** Get server line. *********************************************/         
  4907.                                                                                 
  4908. Bool                                                                            
  4909. GGMgsrvl(gp,pointer,is_cr_needed)                                               
  4910. Rstruc ggcb  *gp;                                                               
  4911. char        **pointer;                                                          
  4912. Fool          is_cr_needed;                                                     
  4913. {                                                                               
  4914.  char              *sbufp;                                                      
  4915.  char              *p;                                                          
  4916.  int                scan_count;                                                 
  4917.  Bool               something_to_print;                                         
  4918.  struct recvstruct *R;                                                          
  4919.                                                                                 
  4920.  *pointer = NULL;                                                               
  4921.                                                                                 
  4922.  /* If local mode, read from temporary file until EOF. */                       
  4923.                                                                                 
  4924.  if ((R=gp->recvp)) {                                                           
  4925.    if (!R->outfp) {                                                             
  4926.      CRIT1("Can't read data locally, non-socket not connected\n");              
  4927.      return FALSE;                                                              
  4928.    }                                                                            
  4929.    fgets(gp->server_buf, SERVER_BUF_MSGSIZE, R->outfp);                         
  4930.    if (ferror(R->outfp)) {                                                      
  4931.      CRIT1("Error reading local non-socket data\n");                            
  4932.      gp->time_to_go_home = TRUE;                                                
  4933.      return FALSE;                                                              
  4934.    }                                                                            
  4935.    if (feof(R->outfp)) return FALSE;                                            
  4936.    if ((p=strchr(gp->server_buf,'\n'))) *p = '\0';                              
  4937.    *pointer = gp->server_buf;                                                   
  4938.    return TRUE;                                                                 
  4939.  }                                                                              
  4940.                                                                                 
  4941.  if (!gp->receiving_text) return TRUE;                                          
  4942.                                                                                 
  4943.  if (gp->server_finished_replying) gp->dont_read = TRUE;                        
  4944.                                                                                 
  4945.  switch (socket_from_server(gp)) {                                              
  4946.    case SERVER_READ_OK:      break;                                             
  4947.    case SERVER_READ_NOTHING: gp->time_to_go_home = TRUE;                        
  4948.                              break;                                             
  4949.    case SERVER_READ_ERROR:   ERR2(                                              
  4950.      "Lost server connection.  Failure reading data from server %s.",           
  4951.                                   gp->ggserver);                                
  4952.                              gp->time_to_go_home = TRUE;                        
  4953.                              break;                                             
  4954.    case SERVER_BUFFER_ERROR: ERR2(                                              
  4955.  "Read error.  No linefeed character found in data from server %s.",            
  4956.                                   gp->ggserver);                                
  4957.                              gp->time_to_go_home = TRUE;                        
  4958.                              break;                                             
  4959.    case SERVER_NO_MORE:      gp->server_has_something_pending = FALSE;          
  4960.                              break;                                             
  4961.  }                                                                              
  4962.                                                                                 
  4963.  if (gp->time_to_go_home == TRUE) return FALSE;                                 
  4964.  if (gp->dont_read == TRUE &&                                                   
  4965.      gp->server_has_something_pending == FALSE) return TRUE;                    
  4966.                                                                                 
  4967.  something_to_print = TRUE;                                                     
  4968.                                                                                 
  4969.  sbufp = gp->server_buf;                                                        
  4970.                                                                                 
  4971.  if (gp->sending_text) {                                                        
  4972.    if (*sbufp == '.') {                                                         
  4973.      switch (*(sbufp+1)) {                                                      
  4974.         case CARRIAGE_RETURN:                                                   
  4975.         case LINE_FEED:                                                         
  4976.         case '\0':                                                              
  4977.                   gp->server_finished_replying = TRUE;                          
  4978.                   something_to_print = FALSE;                                   
  4979.                   break;                                                        
  4980.         case '.':                                                               
  4981.                   break;                                                        
  4982.         default:                                                                
  4983.                   GGMdump(gp,"Warning, bad period in line from server",         
  4984.                           sbufp,strlen(sbufp));                                 
  4985.                   break;                                                        
  4986.      }                                                                          
  4987.    }                                                                            
  4988.  }                                                                              
  4989.                                                                                 
  4990.  gp->sending_text = TRUE;                                                       
  4991.                                                                                 
  4992.  if (something_to_print) {                                                      
  4993.    /* Last character of output buffer is a CR without LF. */                    
  4994.    p = sbufp + strlen(sbufp)-1;                                                 
  4995.    if (p >= sbufp) {                                                            
  4996.      if (*p == CARRIAGE_RETURN) *p = '\0';                                      
  4997.      else if (is_cr_needed) {                                                   
  4998.        /* Last character of output buffer had better be a LF. */                
  4999.        if (gp->debug_file) {                                                    
  5000.          fprintf(gp->debug_file,                                                
  5001.    "Warning: No carriage return in data from server (%d bytes):\n%s\n",         
  5002.                strlen(sbufp), sbufp);                                           
  5003.        }                                                                        
  5004.        CRIT2(                                                                   
  5005. "Carriage return expected but not seen in data from server %s.",                
  5006.              gp->ggserver);                                                     
  5007.      }                                                                          
  5008.      *(p+1) = '\0';                                                             
  5009.    }                                                                            
  5010.    *pointer = sbufp;                                                            
  5011.  }                                                                              
  5012.                                                                                 
  5013.  if (gp->time_to_go_home) return FALSE;                                         
  5014.  else return TRUE;                                                              
  5015. }                                                                               
  5016.                                                                                 
  5017. ./   ADD NAME=GGMIERR,SSI=01000000                                              
  5018.                                                                                 
  5019.  /********************************************************************/         
  5020.  /*                                                                  */         
  5021.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5022.  /*                                                                  */         
  5023.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5024.  /*                                                                  */         
  5025.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5026.  /* including the implied warranties of merchantability and fitness, */         
  5027.  /* are expressly denied.                                            */         
  5028.  /*                                                                  */         
  5029.  /* Provided this copyright notice is included, this software may    */         
  5030.  /* be freely distributed and not offered for sale.                  */         
  5031.  /*                                                                  */         
  5032.  /* Changes or modifications may be made and used only by the maker  */         
  5033.  /* of same, and not further distributed.  Such modifications should */         
  5034.  /* be mailed to the author for consideration for addition to the    */         
  5035.  /* software and incorporation in subsequent releases.               */         
  5036.  /*                                                                  */         
  5037.  /********************************************************************/         
  5038.                                                                                 
  5039. #pragma  csect(code,  "GG@IERR ")                                               
  5040. #pragma  csect(static,"GG$IERR ")                                               
  5041. #include "gg.h"                                                                 
  5042.                                                                                 
  5043. /****** ISPF error handler. ******************************************/         
  5044.                                                                                 
  5045. void                                                                            
  5046. GGMierr(gp)                                                                     
  5047. Rstruc ggcb *gp;                                                                
  5048. {                                                                               
  5049.  char        errbuf[] = "DISPLAY PANEL(ISPTERM)";                               
  5050.  int         errlen;                                                            
  5051.                                                                                 
  5052.  errlen = strlen(errbuf);                                                       
  5053.  switch (ISPEXEC(&errlen,errbuf)) {                                             
  5054.    case  0:                                                                     
  5055.    case  4:                                                                     
  5056.    case  8:                                                                     
  5057.            return;                                                              
  5058.    default:                                                                     
  5059.            fprintf(stderr,                                                      
  5060. "\n*** Severe ISPF error, cannot even display ISPTERM error panel.\n");         
  5061.            fprintf(stderr,                                                      
  5062. "\n*** Return code from ISPF service is %d\n",gp->ispfrc);                      
  5063.            return;                                                              
  5064.  }                                                                              
  5065. }                                                                               
  5066.                                                                                 
  5067. ./   ADD NAME=GGMIGET,SSI=01000045                                              
  5068.                                                                                 
  5069.  /********************************************************************/         
  5070.  /*                                                                  */         
  5071.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5072.  /*                                                                  */         
  5073.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5074.  /*                                                                  */         
  5075.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5076.  /* including the implied warranties of merchantability and fitness, */         
  5077.  /* are expressly denied.                                            */         
  5078.  /*                                                                  */         
  5079.  /* Provided this copyright notice is included, this software may    */         
  5080.  /* be freely distributed and not offered for sale.                  */         
  5081.  /*                                                                  */         
  5082.  /* Changes or modifications may be made and used only by the maker  */         
  5083.  /* of same, and not further distributed.  Such modifications should */         
  5084.  /* be mailed to the author for consideration for addition to the    */         
  5085.  /* software and incorporation in subsequent releases.               */         
  5086.  /*                                                                  */         
  5087.  /********************************************************************/         
  5088.                                                                                 
  5089. #pragma  csect(code,  "GG@IGET ")                                               
  5090. #pragma  csect(static,"GG$IGET ")                                               
  5091. #include "gg.h"                                                                 
  5092.                                                                                 
  5093. /****** Retrieve the value of an ISPF variable into an integer. ******/         
  5094.                                                                                 
  5095. int                                                                             
  5096. GGMiget(gp,varname)                                                             
  5097. Rstruc ggcb *gp;                                                                
  5098. char        *varname;                                                           
  5099. {                                                                               
  5100.  char        varbuf[16];                                                        
  5101.  int         vcopy_length;                                                      
  5102.                                                                                 
  5103.  if (!strchr(varname,' ')) {                                                    
  5104.    fprintf(stderr,"GGMiget: no blank passed in var name\n");                    
  5105.    return FALSE;                                                                
  5106.  }                                                                              
  5107.                                                                                 
  5108.  vcopy_length = sizeof(varbuf);                                                 
  5109.                                                                                 
  5110.  gp->ispfrc = ISPLINK("VCOPY",varname,&vcopy_length,varbuf,"MOVE");             
  5111.  switch (gp->ispfrc) {                                                          
  5112.    case  0:                                                                     
  5113.            varbuf[vcopy_length] = '\0';                                         
  5114.            return atoi(varbuf);                                                 
  5115.    case  8:                                                                     
  5116.            return 0;                                                            
  5117.    case 16:                                                                     
  5118.            fprintf(stderr,                                                      
  5119.                    "Error: ISPF variable buffer too short to get %s\n",         
  5120.                    varname);                                                    
  5121.            return 0;                                                            
  5122.    default:                                                                     
  5123.            GGMierr(gp);   /* handle ISPF error */                               
  5124.            return 0;                                                            
  5125.  }                                                                              
  5126. }                                                                               
  5127.                                                                                 
  5128. ./   ADD NAME=GGMISPF,SSI=01010021                                              
  5129.                                                                                 
  5130.  /********************************************************************/         
  5131.  /*                                                                  */         
  5132.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5133.  /*                                                                  */         
  5134.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5135.  /*                                                                  */         
  5136.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5137.  /* including the implied warranties of merchantability and fitness, */         
  5138.  /* are expressly denied.                                            */         
  5139.  /*                                                                  */         
  5140.  /* Provided this copyright notice is included, this software may    */         
  5141.  /* be freely distributed and not offered for sale.                  */         
  5142.  /*                                                                  */         
  5143.  /* Changes or modifications may be made and used only by the maker  */         
  5144.  /* of same, and not further distributed.  Such modifications should */         
  5145.  /* be mailed to the author for consideration for addition to the    */         
  5146.  /* software and incorporation in subsequent releases.               */         
  5147.  /*                                                                  */         
  5148.  /********************************************************************/         
  5149.                                                                                 
  5150. #pragma  csect(code,  "GG@ISPF ")                                               
  5151. #pragma  csect(static,"GG$ISPF ")                                               
  5152. #include "gg.h"                                                                 
  5153.                                                                                 
  5154. /****** Call ISPF service. *******************************************/         
  5155.                                                                                 
  5156. Bool                                                                            
  5157. GGMispf(gp,ispfbuf)                                                             
  5158. Rstruc ggcb *gp;                                                                
  5159. char        *ispfbuf;                                                           
  5160. {                                                                               
  5161.  int         ispflen;                                                           
  5162.                                                                                 
  5163.  ispflen = strlen(ispfbuf);                                                     
  5164.  gp->ispfrc = ISPEXEC(&ispflen,ispfbuf);                                        
  5165.  if (gp->ispfrc > 8) {                                                          
  5166.                                                                                 
  5167.    /* Ignore ADDPOP and REMPOP errors, especially if they are due to            
  5168.       ISPF V3 not being active. */                                              
  5169.                                                                                 
  5170.    if (gp->ispfrc == 20                                                         
  5171.     && gp->debug_mode == FALSE                                                  
  5172.     && ispflen >= 6                                                             
  5173.     && (memcmp(ispfbuf,"ADDPOP",6) == 0                                         
  5174.      || memcmp(ispfbuf,"REMPOP",6) == 0)) {                                     
  5175.      return TRUE;                                                               
  5176.    }                                                                            
  5177.                                                                                 
  5178.    GGMierr(gp);             /* handle ISPF error */                             
  5179.    return FALSE;                                                                
  5180.  }                                                                              
  5181.  return TRUE;                                                                   
  5182. }                                                                               
  5183.                                                                                 
  5184. ./   ADD NAME=GGMIVGET,SSI=01000024                                             
  5185.                                                                                 
  5186.  /********************************************************************/         
  5187.  /*                                                                  */         
  5188.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5189.  /*                                                                  */         
  5190.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5191.  /*                                                                  */         
  5192.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5193.  /* including the implied warranties of merchantability and fitness, */         
  5194.  /* are expressly denied.                                            */         
  5195.  /*                                                                  */         
  5196.  /* Provided this copyright notice is included, this software may    */         
  5197.  /* be freely distributed and not offered for sale.                  */         
  5198.  /*                                                                  */         
  5199.  /* Changes or modifications may be made and used only by the maker  */         
  5200.  /* of same, and not further distributed.  Such modifications should */         
  5201.  /* be mailed to the author for consideration for addition to the    */         
  5202.  /* software and incorporation in subsequent releases.               */         
  5203.  /*                                                                  */         
  5204.  /********************************************************************/         
  5205.                                                                                 
  5206. #pragma  csect(code,  "GG@IVGET")                                               
  5207. #pragma  csect(static,"GG$IVGET")                                               
  5208. #include "gg.h"                                                                 
  5209.                                                                                 
  5210. /****** Retrieve the value of an ISPF variable. **********************/         
  5211.                                                                                 
  5212. Bool                                                                            
  5213. GGMivget(gp,varname,varbuf,varbuflen)                                           
  5214. Rstruc ggcb *gp;                                                                
  5215. char        *varname;                                                           
  5216. char        *varbuf;                                                            
  5217. int          varbuflen;                                                         
  5218. {                                                                               
  5219.  int         vcopy_length;                                                      
  5220.                                                                                 
  5221.  if (!strchr(varname,' ')) {                                                    
  5222.    fprintf(stderr,"GGMivget: no blank passed in var name\n");                   
  5223.    return FALSE;                                                                
  5224.  }                                                                              
  5225.                                                                                 
  5226.  /*                                                                             
  5227.   * If varbuflen is negative, that means that the value is not to be            
  5228.   * treated as a C string, and the null character is not to be                  
  5229.   * appended to the resulting value.  This is used for hex values               
  5230.   * (like addresses) that are stored in ISPF table row variables.               
  5231.   */                                                                            
  5232.                                                                                 
  5233.  if (varbuflen < 0)  vcopy_length = -varbuflen;                                 
  5234.  else vcopy_length = varbuflen;                                                 
  5235.                                                                                 
  5236.  /* Note that on entry, vcopy_length is an integer that contains                
  5237.     the length of the buffer.  On return it is updated to the length            
  5238.     of the value returned.  Since we have to stick a null character             
  5239.     on the end of it for C, the actual buffer passed must be at least           
  5240.     one character longer than the length as defined to ISPF.                    
  5241.  */                                                                             
  5242.                                                                                 
  5243.  gp->ispfrc = ISPLINK("VCOPY",varname,&vcopy_length,varbuf,"MOVE");             
  5244.  switch (gp->ispfrc) {                                                          
  5245.    case  0:                                                                     
  5246.            if (varbuflen >= 0)                                                  
  5247.               varbuf[vcopy_length] = '\0';                                      
  5248.            return TRUE;                                                         
  5249.    case  8:                                                                     
  5250.            strcpy(varbuf,"");                                                   
  5251.            return TRUE;                                                         
  5252.    case 16:                                                                     
  5253.            fprintf(stderr,                                                      
  5254.                    "Error: ISPF variable buffer too short to get %s\n",         
  5255.                    varname);                                                    
  5256.            return FALSE;                                                        
  5257.    default:                                                                     
  5258.            GGMierr(gp);   /* handle ISPF error */                               
  5259.            return FALSE;                                                        
  5260.  }                                                                              
  5261. }                                                                               
  5262.                                                                                 
  5263. ./   ADD NAME=GGMIVPUT,SSI=01000024                                             
  5264.                                                                                 
  5265.  /********************************************************************/         
  5266.  /*                                                                  */         
  5267.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5268.  /*                                                                  */         
  5269.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5270.  /*                                                                  */         
  5271.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5272.  /* including the implied warranties of merchantability and fitness, */         
  5273.  /* are expressly denied.                                            */         
  5274.  /*                                                                  */         
  5275.  /* Provided this copyright notice is included, this software may    */         
  5276.  /* be freely distributed and not offered for sale.                  */         
  5277.  /*                                                                  */         
  5278.  /* Changes or modifications may be made and used only by the maker  */         
  5279.  /* of same, and not further distributed.  Such modifications should */         
  5280.  /* be mailed to the author for consideration for addition to the    */         
  5281.  /* software and incorporation in subsequent releases.               */         
  5282.  /*                                                                  */         
  5283.  /********************************************************************/         
  5284.                                                                                 
  5285. #pragma  csect(code,  "GG@IVPUT")                                               
  5286. #pragma  csect(static,"GG$IVPUT")                                               
  5287. #include "gg.h"                                                                 
  5288.                                                                                 
  5289. /****** Set the value of an ISPF variable. ***************************/         
  5290.                                                                                 
  5291. Bool                                                                            
  5292. GGMivput(gp,varname,varbuf,varlen)                                              
  5293. Rstruc ggcb *gp;                                                                
  5294. char        *varname;                                                           
  5295. char        *varbuf;                                                            
  5296. int          varlen;                                                            
  5297. {                                                                               
  5298.  int         vreplace_length;                                                   
  5299.                                                                                 
  5300.  vreplace_length = (varlen<0 ? strlen(varbuf) : varlen);                        
  5301.                                                                                 
  5302.  gp->ispfrc = ISPLINK("VREPLACE",varname,&vreplace_length,varbuf);              
  5303.  switch (gp->ispfrc) {                                                          
  5304.    case  0:                                                                     
  5305.            return TRUE;                                                         
  5306.    case 16:                                                                     
  5307.            fprintf(stderr,                                                      
  5308.                    "Error: ISPF variable buffer too short to put %s\n",         
  5309.                    varname);                                                    
  5310.            return FALSE;                                                        
  5311.    default:                                                                     
  5312.            GGMierr(gp);   /* handle ISPF error */                               
  5313.            return FALSE;                                                        
  5314.  }                                                                              
  5315. }                                                                               
  5316.                                                                                 
  5317. ./   ADD NAME=GGMMTFER,SSI=01030000                                             
  5318.                                                                                 
  5319.  /********************************************************************/         
  5320.  /*                                                                  */         
  5321.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5322.  /*                                                                  */         
  5323.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5324.  /*                                                                  */         
  5325.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5326.  /* including the implied warranties of merchantability and fitness, */         
  5327.  /* are expressly denied.                                            */         
  5328.  /*                                                                  */         
  5329.  /* Provided this copyright notice is included, this software may    */         
  5330.  /* be freely distributed and not offered for sale.                  */         
  5331.  /*                                                                  */         
  5332.  /* Changes or modifications may be made and used only by the maker  */         
  5333.  /* of same, and not further distributed.  Such modifications should */         
  5334.  /* be mailed to the author for consideration for addition to the    */         
  5335.  /* software and incorporation in subsequent releases.               */         
  5336.  /*                                                                  */         
  5337.  /********************************************************************/         
  5338.                                                                                 
  5339. #pragma  csect(code,  "GG@MTFER")                                               
  5340. #pragma  csect(static,"GG$MTFER")                                               
  5341. #include "gg.h"                                                                 
  5342.                                                                                 
  5343. /*********************************************************************/         
  5344.                                                                                 
  5345. void                                                                            
  5346. GGMmtfer(                                                                       
  5347.          int          retcode,                                                  
  5348.          char        *kind)                                                     
  5349. {                                                                               
  5350.  char    *ermsg;                                                                
  5351.                                                                                 
  5352.  switch (retcode) {                                                             
  5353.    case MTF_OK:                                                                 
  5354.         ermsg = NULL;                                                           
  5355.         break;                                                                  
  5356.    case EINACTIVE:                                                              
  5357.         ermsg = "MTF is inactive";                                              
  5358.         break;                                                                  
  5359.    case ESUBCALL:                                                               
  5360.         ermsg = "The MTF call was issued from a subtask";                       
  5361.         break;                                                                  
  5362.    case EWRONGOS:                                                               
  5363.         ermsg = "MTF is not supported under CMS, IMS, CICS, or DB2";            
  5364.         break;                                                                  
  5365.    case EACTIVE:                                                                
  5366.         ermsg = "MTF has already been initialized and is active";               
  5367.         break;                                                                  
  5368.    case ENAME2LNG:                                                              
  5369.         ermsg = "The parallel module name is longer than 8 characters";         
  5370.         break;                                                                  
  5371.    case ETASKNUM:                                                               
  5372.         ermsg = "The number of tasks specified is invalid";                     
  5373.         break;                                                                  
  5374.    case ENOMEM:                                                                 
  5375.         ermsg = "Insufficient storage for MTF internal areas";                  
  5376.         break;                                                                  
  5377.    case EMODFIND:                                                               
  5378.         ermsg = "The parallel load module was not found";                       
  5379.         break;                                                                  
  5380.    case EMODREAD:                                                               
  5381.         ermsg = "The parallel load module was not sucessfully read";            
  5382.         break;                                                                  
  5383.    case EMODFMT:                                                                
  5384.         ermsg = "The parallel load module format is invalid";                   
  5385.         break;                                                                  
  5386.    case EAUTOALC:                                                               
  5387.         ermsg = "Automatic allocation of standard stream DD failed";            
  5388.         break;                                                                  
  5389.    case ETASKFAIL:                                                              
  5390.         ermsg = "The attempt to attach task(s) has failed";                     
  5391.         break;                                                                  
  5392.    case ETASKABND:                                                              
  5393.         ermsg = "One or more subtasks have abnormally terminated";              
  5394.         break;                                                                  
  5395.    case EBADLNKG:                                                               
  5396.         ermsg = "TSCHED has been invoked via invalid linkage";                  
  5397.         break;                                                                  
  5398.    case ETASKID:                                                                
  5399.         ermsg = "The task ID specified is not valid";                           
  5400.         break;                                                                  
  5401.    case EENTRY:                                                                 
  5402.         ermsg = "The parallel function was not in the parallel module";         
  5403.         break;                                                                  
  5404.    default:                                                                     
  5405.         ermsg = "Unknown MTF error";                                            
  5406.         break;                                                                  
  5407.  }                                                                              
  5408.                                                                                 
  5409.  if (ermsg) {                                                                   
  5410.    fprintf(stderr,"GGSERVER: %s error code %d:\n %s\n",                         
  5411.                   kind, retcode, ermsg);                                        
  5412.  }                                                                              
  5413.                                                                                 
  5414.  return;                                                                        
  5415.                                                                                 
  5416. }                                                                               
  5417.                                                                                 
  5418. ./   ADD NAME=GGMOUTS,SSI=01050059                                              
  5419.                                                                                 
  5420.  /********************************************************************/         
  5421.  /*                                                                  */         
  5422.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5423.  /*                                                                  */         
  5424.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5425.  /* including the implied warranties of merchantability and fitness, */         
  5426.  /* are expressly denied.                                            */         
  5427.  /*                                                                  */         
  5428.  /* Provided this copyright notice is included, this software may    */         
  5429.  /* be freely distributed and not offered for sale.                  */         
  5430.  /*                                                                  */         
  5431.  /* Changes or modifications may be made and used only by the maker  */         
  5432.  /* of same, and not further distributed.  Such modifications should */         
  5433.  /* be mailed to the author for consideration for addition to the    */         
  5434.  /* software and incorporation in subsequent releases.               */         
  5435.  /*                                                                  */         
  5436.  /********************************************************************/         
  5437.                                                                                 
  5438. #pragma  csect(code,  "GG@MOUTS")                                               
  5439. #pragma  csect(static,"GG$MOUTS")                                               
  5440.                                                                                 
  5441. #include "gg.h"                                                                 
  5442. /*                                                                              
  5443.  ***********************************************************************        
  5444.  *                                                                     *        
  5445.  * This is a Gopher server routine that outputs data to a socket.      *        
  5446.  *                                                                     *        
  5447.  * If the "socket" is actually a file pointer, then output is          *        
  5448.  * written to the file pointer.                                        *        
  5449.  *                                                                     *        
  5450.  ***********************************************************************        
  5451.  */                                                                             
  5452.                                                                                 
  5453. /*=================================================================*/           
  5454.                                                                                 
  5455. Bool                                                                            
  5456. GGMouts(struct recvstruct *R,                                                   
  5457.         char              *text)                                                
  5458. {                                                                               
  5459.  int                len;                                                        
  5460.  int                reallen;                                                    
  5461.  Bool               rc;                                                         
  5462.  char               outbuf[515];  /* hold an output character string */         
  5463.                                                                                 
  5464.  if (R->outfp) {                    /* if using non-socket interface */         
  5465.    if (fputs(text,R->outfp) < 0) {                                              
  5466.      fprintf(stderr,"Error writing to output file\n");                          
  5467.      return FALSE;                                                              
  5468.    }                                                                            
  5469.    if (fputc('\n',R->outfp) < 0) {                                              
  5470.      fprintf(stderr,"Error writing to output file\n");                          
  5471.      return FALSE;                                                              
  5472.    }                                                                            
  5473.    return TRUE;                                                                 
  5474.  }                                                                              
  5475.                                                                                 
  5476.  if (text == NULL) {                                                            
  5477.    outbuf[0] = '.';                                                             
  5478.    len = 1;                                                                     
  5479.  }                                                                              
  5480.  else {                                                                         
  5481.    len = strlen(text);                                                          
  5482.    if (len >= sizeof(outbuf)-3) len = sizeof(outbuf)-3;                         
  5483.    if (text[0] == '.') {                                                        
  5484.      outbuf[0] = '.';                                                           
  5485.      memcpy(outbuf+1,text,len);                                                 
  5486.      len++;                                                                     
  5487.    }                                                                            
  5488.    else {                                                                       
  5489.      memcpy(outbuf,text,len);                                                   
  5490.    }                                                                            
  5491.  }                                                                              
  5492.  outbuf[len  ] = CARRIAGE_RETURN;                                               
  5493.  outbuf[len+1] = LINE_FEED;                                                     
  5494.  outbuf[len+2] = '\0';                                                          
  5495.  reallen = len + 2;                                                             
  5496.                                                                                 
  5497. #ifdef SNSTCPIP                                                                 
  5498.  EBCDIC_TO_ASCII(outbuf,reallen);                                               
  5499. #else                                                                           
  5500.  ebdtoasc(outbuf);                                                              
  5501. #endif                                                                          
  5502.                                                                                 
  5503.  rc = TRUE;                                                                     
  5504.                                                                                 
  5505.  if (R->outlen + reallen > sizeof(R->sockbuf)) {                                
  5506.                                                                                 
  5507.    if (write(R->sockfd,R->sockbuf,R->outlen) < 0) {                             
  5508.      REPORT_TCP_ERROR("SEND");                                                  
  5509.      rc = FALSE;                                                                
  5510.    }                                                                            
  5511.    R->outlen = 0;                                                               
  5512.  }                                                                              
  5513.                                                                                 
  5514.  memcpy(R->sockbuf + R->outlen, outbuf, reallen);                               
  5515.  R->outlen += reallen;                                                          
  5516.                                                                                 
  5517.  if (text == NULL) {  /* flush socket */                                        
  5518.    if (write(R->sockfd,R->sockbuf,R->outlen) < 0) {                             
  5519.      REPORT_TCP_ERROR("SEND");                                                  
  5520.      rc = FALSE;                                                                
  5521.    }                                                                            
  5522.  }                                                                              
  5523.  return rc;                                                                     
  5524. }                                                                               
  5525.                                                                                 
  5526. ./   ADD NAME=GGMOUTTX,SSI=01010057                                             
  5527.                                                                                 
  5528.  /********************************************************************/         
  5529.  /*                                                                  */         
  5530.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5531.  /*                                                                  */         
  5532.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5533.  /*                                                                  */         
  5534.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5535.  /* including the implied warranties of merchantability and fitness, */         
  5536.  /* are expressly denied.                                            */         
  5537.  /*                                                                  */         
  5538.  /* Provided this copyright notice is included, this software may    */         
  5539.  /* be freely distributed and not offered for sale.                  */         
  5540.  /*                                                                  */         
  5541.  /* Changes or modifications may be made and used only by the maker  */         
  5542.  /* of same, and not further distributed.  Such modifications should */         
  5543.  /* be mailed to the author for consideration for addition to the    */         
  5544.  /* software and incorporation in subsequent releases.               */         
  5545.  /*                                                                  */         
  5546.  /********************************************************************/         
  5547.                                                                                 
  5548. #pragma  csect(code,  "GG@OUTTX")                                               
  5549. #pragma  csect(static,"GG$OUTTX")                                               
  5550. #include "gg.h"                                                                 
  5551.                                                                                 
  5552. /****** Output a line of text retrieved from the server. *************/         
  5553.                                                                                 
  5554. struct textline *                                                               
  5555. GGMouttx(gp,line,ip)                                                            
  5556. Rstruc ggcb         *gp;                                                        
  5557. char                *line;                                                      
  5558. Rstruc gopherinfo   *ip;                                                        
  5559.                                                                                 
  5560. {                                                                               
  5561.  struct texthdr     *thp;                                                       
  5562.  struct textline    *tp;                                                        
  5563.  short              line_length;                                                
  5564.  short              total_text_length;                                          
  5565.  short              tab_expansion_length;                                       
  5566.  Bool               tabs_present;                                               
  5567.  char              *p;                                                          
  5568.  char              *q;                                                          
  5569.  char              *t;                                                          
  5570.  int                e;                                                          
  5571.  int                u;                                                          
  5572.                                                                                 
  5573.  static char        tab_expansion_buffer[8*TEXT_BYTES];                         
  5574.                                                                                 
  5575.  thp = (ip ? &ip->thdr : &gp->thdr);                                            
  5576.                                                                                 
  5577.  /* If line starts with double period, make it a single period. */              
  5578.                                                                                 
  5579.  if (ip && memcmp(line,"..",2) == 0) line++;                                    
  5580.                                                                                 
  5581.  /* Add this line to the current queue of server text lines. */                 
  5582.                                                                                 
  5583.  /* First, expand tabs in the line. */                                          
  5584.                                                                                 
  5585.  line_length = strlen(line);                                                    
  5586.  t = strchr(line,'\t');                                                         
  5587.  if (t == NULL) {                                                               
  5588.    tabs_present = FALSE;                                                        
  5589.    total_text_length = line_length + 1;                                         
  5590.  }                                                                              
  5591.  else {                                   /* expand tabs */                     
  5592.    tabs_present = TRUE;                                                         
  5593.    p = line;                                                                    
  5594.    q = line + line_length;                                                      
  5595.    e = 0;                                                                       
  5596.    memset(tab_expansion_buffer,' ',sizeof(tab_expansion_buffer));               
  5597.    while (TRUE) {                                                               
  5598.      u = t-p;                                                                   
  5599.      if (u > 0) {                                                               
  5600.        memcpy(tab_expansion_buffer+e,p,u);                                      
  5601.        e += u;                                                                  
  5602.      }                                                                          
  5603.      if (t == q) break;                                                         
  5604.      e = e / 8 * 8 + 8;                                                         
  5605.      p = t+1;                                                                   
  5606.      t = strchr(p,'\t');                                                        
  5607.      if (t == NULL) t = q;                                                      
  5608.    }                                                                            
  5609.    tab_expansion_length = e;                                                    
  5610.    tab_expansion_buffer[tab_expansion_length] = '\0';                           
  5611.    total_text_length = line_length + tab_expansion_length + 1;                  
  5612.  }                                                                              
  5613.                                                                                 
  5614.  GETMAIN(tp, char, offsetof(struct textline, text) + total_text_length,         
  5615.                    "text line");                                                
  5616.                                                                                 
  5617.  if (tp == NULL) {                                                              
  5618.    ERR1("There is not enough virtual storage to process server text.");         
  5619.    return NULL;                                                                 
  5620.  }                                                                              
  5621.                                                                                 
  5622.  tp->next = NULL;                                                               
  5623.  tp->text_length = line_length;                                                 
  5624.  strcpy(tp->text,line);                                                         
  5625.  if (tabs_present) {                                                            
  5626.    tp->tab_expanded_text_length = tab_expansion_length;                         
  5627.    tp->tab_expanded_text = tp->text + line_length;                              
  5628.    strcpy(tp->tab_expanded_text,tab_expansion_buffer);                          
  5629.  }                                                                              
  5630.  else {                                                                         
  5631.    tp->tab_expanded_text_length = line_length;                                  
  5632.    tp->tab_expanded_text = tp->text;                                            
  5633.  }                                                                              
  5634.                                                                                 
  5635.  if (thp->last_text_line == NULL) {                                             
  5636.    thp->first_text_line   = tp;                                                 
  5637.    thp->text_body_line    = tp;                                                 
  5638.    thp->current_text_line = tp;                                                 
  5639.  }                                                                              
  5640.  else thp->last_text_line->next = tp;                                           
  5641.                                                                                 
  5642.  thp->last_text_line = tp;                                                      
  5643.  thp->text_line_count++;                                                        
  5644.                                                                                 
  5645.  if (thp->text_max_length < tp->text_length)                                    
  5646.      thp->text_max_length = tp->text_length;                                    
  5647.  if (thp->text_max_tab_expanded_length < tp->tab_expanded_text_length)          
  5648.      thp->text_max_tab_expanded_length = tp->tab_expanded_text_length;          
  5649.                                                                                 
  5650.  return tp;                                                                     
  5651.                                                                                 
  5652. }                                                                               
  5653.                                                                                 
  5654. ./   ADD NAME=GGMPMSG,SSI=01000057                                              
  5655.                                                                                 
  5656.  /********************************************************************/         
  5657.  /*                                                                  */         
  5658.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  5659.  /*                                                                  */         
  5660.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5661.  /*                                                                  */         
  5662.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5663.  /* including the implied warranties of merchantability and fitness, */         
  5664.  /* are expressly denied.                                            */         
  5665.  /*                                                                  */         
  5666.  /* Provided this copyright notice is included, this software may    */         
  5667.  /* be freely distributed and not offered for sale.                  */         
  5668.  /*                                                                  */         
  5669.  /* Changes or modifications may be made and used only by the maker  */         
  5670.  /* of same, and not further distributed.  Such modifications should */         
  5671.  /* be mailed to the author for consideration for addition to the    */         
  5672.  /* software and incorporation in subsequent releases.               */         
  5673.  /*                                                                  */         
  5674.  /********************************************************************/         
  5675.                                                                                 
  5676. #define  SUPPRESS_V_DECLARATION                                                 
  5677. #pragma  csect(code,  "GG@PMSG ")                                               
  5678. #pragma  csect(static,"GG$PMSG ")                                               
  5679. #include "gg.h"                                                                 
  5680.                                                                                 
  5681. /****** Set an ISPF message, or write to SYSOUT if batch mode. *******/         
  5682.                                                                                 
  5683. void                                                                            
  5684. GGMpmsg(gp,msgtype,msghelp,msgformat) /* also ... for sprintf args */           
  5685. Rstruc ggcb *gp;                                                                
  5686. int          msgtype;                                                           
  5687. char        *msghelp;                                                           
  5688. char        *msgformat;                                                         
  5689. {                                                                               
  5690.  va_list     argp;                                                              
  5691.  char       *cp;                                                                
  5692.  char        zerrsm    [25];                                                    
  5693.  char        zerrhm     [9];                                                    
  5694.  char        zerralrm   [4];                                                    
  5695.  char        zerrlm    [73];                                                    
  5696.  char        buf      [257];                                                    
  5697.                                                                                 
  5698.  va_start(argp,msgformat);                                                      
  5699.  vsprintf(buf,msgformat,argp);                                                  
  5700.  va_end(argp);                                                                  
  5701.                                                                                 
  5702.  cp = strchr(buf,';');                                                          
  5703.  if (cp) {                                                                      
  5704.   *cp = '\0';                                                                   
  5705.   strncpy(zerrsm,buf, sizeof(zerrsm));                                          
  5706.   strncpy(zerrlm,cp+1,sizeof(zerrlm));                                          
  5707.  }                                                                              
  5708.  else {                                                                         
  5709.   strcpy(zerrsm,"");                                                            
  5710.   strncpy(zerrlm,buf,sizeof(zerrlm));                                           
  5711.  }                                                                              
  5712.                                                                                 
  5713.  zerrsm[sizeof(zerrsm)-1] = '\0';                                               
  5714.  zerrlm[sizeof(zerrlm)-1] = '\0';                                               
  5715.                                                                                 
  5716.  if (msghelp) strcpy(zerrhm, msghelp);                                          
  5717.  else         strcpy(zerrhm, "*"    );                                          
  5718.                                                                                 
  5719.  switch (msgtype) {                                                             
  5720.    case NOTIFY_MSG:    strcpy(zerralrm,"NO "); break;                           
  5721.    case WARNING_MSG:                                                            
  5722.    case CRITICAL_MSG:                                                           
  5723.    default:            strcpy(zerralrm,"YES"); break;                           
  5724.  }                                                                              
  5725.                                                                                 
  5726.  (void)GGMivput(gp,"ZERRSM ",  zerrsm,   -1);                                   
  5727.  (void)GGMivput(gp,"ZERRLM ",  zerrlm,   -1);                                   
  5728.  (void)GGMivput(gp,"ZERRHM ",  zerrhm,   -1);                                   
  5729.  (void)GGMivput(gp,"ZERRALRM ",zerralrm, -1);                                   
  5730.                                                                                 
  5731.  if (gp->brifp) {                                                               
  5732.    (void)GGMispf(gp,"SETMSG MSG(ISRZ002)");                                     
  5733.  }                                                                              
  5734.  else {                                                                         
  5735.    gp->setmsg = TRUE;                                                           
  5736.  }                                                                              
  5737.                                                                                 
  5738.  return;                                                                        
  5739. }                                                                               
  5740.                                                                                 
  5741. ./   ADD NAME=GGMPROC,SSI=01160000                                              
  5742.                                                                                 
  5743.  /********************************************************************/         
  5744.  /*                                                                  */         
  5745.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  5746.  /*                                                                  */         
  5747.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  5748.  /* including the implied warranties of merchantability and fitness, */         
  5749.  /* are expressly denied.                                            */         
  5750.  /*                                                                  */         
  5751.  /* Provided this copyright notice is included, this software may    */         
  5752.  /* be freely distributed and not offered for sale.                  */         
  5753.  /*                                                                  */         
  5754.  /* Changes or modifications may be made and used only by the maker  */         
  5755.  /* of same, and not further distributed.  Such modifications should */         
  5756.  /* be mailed to the author for consideration for addition to the    */         
  5757.  /* software and incorporation in subsequent releases.               */         
  5758.  /*                                                                  */         
  5759.  /********************************************************************/         
  5760.                                                                                 
  5761. #pragma  csect(code,  "GG@MPROC")                                               
  5762. #pragma  csect(static,"GG$MPROC")                                               
  5763.                                                                                 
  5764. #pragma  linkage(IRXEXEC,OS)                                                    
  5765.                                                                                 
  5766. #include "gg.h"                                                                 
  5767.                                                                                 
  5768. /**********************************************************************         
  5769.  *                                                                    *         
  5770.  * Changes: 02/17/93 Fixed memcmp logic in append-domain-name code.   *         
  5771.  *                                                                    *         
  5772.  **********************************************************************/        
  5773.                                                                                 
  5774. /*=================================================================*/           
  5775.                                                                                 
  5776. /*******************************************************************/           
  5777. /*   This routine cleans up a token.  It converts all chars to     */           
  5778. /*   upper case and removes any leading spaces. Note that the      */           
  5779. /*   string is assumed to be null terminated.                      */           
  5780. /*                                                                 */           
  5781. /*       INPUT    token          pointer to token string.          */           
  5782. /*       OUTPUT   *token         string upcased, blanks removed.   */           
  5783. /*******************************************************************/           
  5784.                                                                                 
  5785. static char *                                                                   
  5786. uppercase_and_trim_leading_space(char *token)                                   
  5787. {                                                                               
  5788.                                                                                 
  5789.  uppercase_in_place(token);                                                     
  5790.                                                                                 
  5791.  return token + strspn(token," ");                                              
  5792. };                                                                              
  5793.                                                                                 
  5794. /*=================================================================*/           
  5795.                                                                                 
  5796. /****************************************************/                          
  5797. /* This routine "cleans" a string by removing the   */                          
  5798. /* leading spaces and trailing spaces+non-printable */                          
  5799. /* characters.                                      */                          
  5800. /****************************************************/                          
  5801.                                                                                 
  5802. static char *                                                                   
  5803. trim_leading_and_trailing_space(char *string)                                   
  5804. {                                                                               
  5805. char *str;                                                                      
  5806. char *ptr;                                                                      
  5807.                                                                                 
  5808.  /*  first clean up the beginning of the string... */                           
  5809.                                                                                 
  5810.  str = string + strspn(string," \t");                                           
  5811.                                                                                 
  5812.  /*    now look at the end of the string... */                                  
  5813.                                                                                 
  5814.  ptr = str+strlen(str)-1;                                                       
  5815.  while (!isgraph(*ptr) && ptr >=str) ptr--;                                     
  5816.  *(ptr+1)=0;                                                                    
  5817.                                                                                 
  5818.  return str;                                                                    
  5819. }                                                                               
  5820.                                                                                 
  5821. /*=================================================================*/           
  5822.                                                                                 
  5823. /****************************************************/                          
  5824. /* This routine "cleans" an output line by removing */                          
  5825. /* trailing spaces and non-printable characters.    */                          
  5826. /****************************************************/                          
  5827.                                                                                 
  5828. static void                                                                     
  5829. trim_trailing_space(char *string)                                               
  5830. {                                                                               
  5831.  char *ptr;                                                                     
  5832.                                                                                 
  5833.  ptr = string;                                                                  
  5834.                                                                                 
  5835.  /*  look at the end of the string... */                                        
  5836.                                                                                 
  5837.  ptr = string+strlen(string)-1;                                                 
  5838.  while (isgraph(*ptr)==0 && ptr >=string) ptr--;                                
  5839.  *(ptr+1)=0;                                                                    
  5840. }                                                                               
  5841.                                                                                 
  5842. /*=================================================================*/           
  5843.                                                                                 
  5844. static void                                                                     
  5845. gbarf(struct recvstruct *R,                                                     
  5846.       char              *message)                                               
  5847. {                                                                               
  5848.  char        temp[257];                                                         
  5849.                                                                                 
  5850.  /* the number should be 3 (ERROR) but some clients may not show it             
  5851.   *             |                                                               
  5852.   *             |                                                               
  5853.   *             |                                                               
  5854.   *             V                                                               
  5855.   */                                                                            
  5856.  sprintf(temp, "1Sorry, %s.\t0\t0\t0", message);                                
  5857.                                                                                 
  5858.  (void)GGMouts(R,temp);                                                         
  5859.                                                                                 
  5860.  return;                                                                        
  5861. }                                                                               
  5862.                                                                                 
  5863. /*=================================================================*/           
  5864.                                                                                 
  5865. static Bool                                                                     
  5866. insure_my_name(struct recvstruct *R)                                            
  5867. {                                                                               
  5868.  int                hostlen;                                                    
  5869.  int                domslen;                                                    
  5870.                                                                                 
  5871.  /* Determine the local path name, if not already set. */                       
  5872.                                                                                 
  5873.  if (!*R->myname) {                                                             
  5874.    if (gethostname(R->myname,MAXHOSTNAMELEN) < 0) {                             
  5875.      fprintf(stderr,"GOPHER:gethostname() failed, can't get my name\n");        
  5876.      gbarf(R,"the GOPHER server had an attack of amnesia");                     
  5877.      return FALSE;                                                              
  5878.    }                                                                            
  5879.                                                                                 
  5880. #ifdef APPEND_DOMAIN_NAME_TO_SELF                                               
  5881.                                                                                 
  5882.    hostlen = strlen(R->myname);                                                 
  5883.    domslen = sizeof(MY_DOMAIN_SUFFIX) - 1;                                      
  5884.    if (hostlen <= domslen ||                                                    
  5885.        memcmp(R->myname+hostlen-domslen, MY_DOMAIN_SUFFIX, domslen)) {          
  5886.      strncat(R->myname,MY_DOMAIN_SUFFIX,domslen);                               
  5887.    }                                                                            
  5888.                                                                                 
  5889. #endif                                                                          
  5890.                                                                                 
  5891.    uppercase_in_place(R->myname);                                               
  5892.                                                                                 
  5893.    fprintf(stderr,"Local hostname set to '%s'\n",R->myname);                    
  5894.                                                                                 
  5895.  }                                                                              
  5896.                                                                                 
  5897.  return TRUE;                                                                   
  5898.                                                                                 
  5899. }                                                                               
  5900.                                                                                 
  5901. /*=================================================================*/           
  5902.                                                                                 
  5903. static Bool                                                                     
  5904. authorized_file(struct recvstruct *R)                                           
  5905. {                                                                               
  5906.  char    *cp;                                                                   
  5907.  FILE    *afp;                                                                  
  5908.  int      n;                                                                    
  5909.  int      hostcount;                                                            
  5910.  Bool     rc;                                                                   
  5911.  char     filetest[RBUFSIZE];                                                   
  5912.  char     accline [RBUFSIZE];                                                   
  5913.  char     accfile [RBUFSIZE];                                                   
  5914.  char     acchost [RBUFSIZE];                                                   
  5915.                                                                                 
  5916.  /* If non-socket interface, bypass the authorization check. */                 
  5917.                                                                                 
  5918.  if (R->outfp) return TRUE;                                                     
  5919.                                                                                 
  5920.  /* Check that the server is allowed to return data from the file               
  5921.   * specified in R->fileptr.  Note that this could be the name of               
  5922.   * an exec.  The name will be (dataset), EXEC:execname, or DD:file             
  5923.   * - we look at only the first part, whitespace-delimited.                     
  5924.   * Entries in the file authorization table look as above.                      
  5925.   */                                                                            
  5926.                                                                                 
  5927.  rc = FALSE;                                                                    
  5928.  filetest[0] = '\0';                                                            
  5929.  sscanf(R->fileptr,"%s",filetest);                                              
  5930.                                                                                 
  5931.  /* Read authorization file. */                                                 
  5932.                                                                                 
  5933.  afp = fopen(ACCESS_TABLE,"r");                                                 
  5934.  if (!afp) {                                                                    
  5935.    perror(ACCESS_TABLE);                                                        
  5936.    fflush(stderr);                                                              
  5937.    return FALSE;                                                                
  5938.  }                                                                              
  5939.                                                                                 
  5940.  for (;;) {                                                                     
  5941.    fgets(accline, sizeof(accline), afp);                                        
  5942.    if (ferror(afp)) {                                                           
  5943.      fprintf(stderr,"Error reading access table %s\n",ACCESS_TABLE);            
  5944.      fflush(stderr);                                                            
  5945.      break;                                                                     
  5946.    }                                                                            
  5947.    if (feof(afp)) break;                                                        
  5948.    /* format of line is: filename machine(s) */                                 
  5949.    uppercase_in_place(accline);                                                 
  5950.    cp = accline;                      /* Start scan pointer         */          
  5951.    *accfile = '\0';                   /* Clear access file name     */          
  5952.    sscanf(cp,"%s %n",accfile,&n);     /* Get file name, bump scan   */          
  5953.    if (!strcmp(filetest,accfile)) {   /* If file name matches       */          
  5954.      hostcount = 0;                   /* Clear access host count    */          
  5955.      for (;;) {                       /* Loop over access host ids  */          
  5956.        cp += n;                       /* Bump to next word in file  */          
  5957.        *acchost = '\0';               /* Clear word before scanf    */          
  5958.        sscanf(cp,"%s %n",acchost,&n); /* Get next word, bump scan   */          
  5959.        if (!*acchost) break;          /* exit loop if no more hosts */          
  5960.        hostcount++;                   /* increment access host count*/          
  5961.        if (!strcmp(R->hostname,acchost)                                         
  5962.         || !strcmp(R->hosttest,acchost)) { /* if hostname matches */            
  5963.          rc = TRUE;                        /* access is allowed   */            
  5964.          break;                                                                 
  5965.        }                                                                        
  5966.      }                                                                          
  5967.      if (!rc) {                       /* If no matching host found  */          
  5968.        if (hostcount == 0) rc = TRUE; /* if no access hosts, say OK */          
  5969.      }                                                                          
  5970.      if (rc) break;                   /* if access OK, finished     */          
  5971.                                                                                 
  5972.      /* If access is not permitted, we keep checking because                    
  5973.       * there may be more than one entry in the access table                    
  5974.       * for this file, so that many host names can be given.                    
  5975.       */                                                                        
  5976.                                                                                 
  5977.    }                                                                            
  5978.  }                                                                              
  5979.                                                                                 
  5980.  (void)fclose(afp);                                                             
  5981.                                                                                 
  5982.  if (!rc) {                                                                     
  5983.    fprintf(stderr,"Not authorized from %s: '%s'\n",                             
  5984.                   R->hosttest, filetest);                                       
  5985.  }                                                                              
  5986.                                                                                 
  5987.  fflush(stderr);                                                                
  5988.                                                                                 
  5989.  return rc;                                                                     
  5990. }                                                                               
  5991.                                                                                 
  5992. /*=================================================================*/           
  5993.                                                                                 
  5994. /*******************************************************************/           
  5995. /*            This routine determines what type of gopher file     */           
  5996. /*            we've opened.  We'll return the file type to the     */           
  5997. /*            caller.                                              */           
  5998. /*                                                                 */           
  5999. /*            INPUT:   ident   pointer to first line of file       */           
  6000. /*                                                                 */           
  6001. /*            OUTPUT:   MENU   file type is a menu                 */           
  6002. /*                      FILE   file type is a file                 */           
  6003. /*                      INDEX  file type is an INDEX (not done)    */           
  6004. /*******************************************************************/           
  6005.                                                                                 
  6006. static char                                                                     
  6007. getftype(char *ident)                                                           
  6008. {                                                                               
  6009.  int   x;                              /* loop counter */                       
  6010.  char  buffer[RBUFSIZE];                                                        
  6011.  char *bufptr;                                                                  
  6012.                                                                                 
  6013.  /**********/                                                                   
  6014.  /*   first, convert the string to upper case...   */                           
  6015.  /*********/                                                                    
  6016.  strcpy(buffer,ident);                                                          
  6017.  bufptr = uppercase_and_trim_leading_space(buffer);                             
  6018.                                                                                 
  6019.  /**********/                                                                   
  6020.  /*   return the type of file.                     */                           
  6021.  /*********/                                                                    
  6022.                                                                                 
  6023.  if(strcmp(bufptr,MENUIDENT)==0) return(MENU);                                  
  6024.  if(strcmp(bufptr,INDEXIDENT)==0) return(INDEX);                                
  6025.                                                                                 
  6026.  /**********/                                                                   
  6027.  /*   don't know, so assume it's a "file" file...    */                         
  6028.  /*********/                                                                    
  6029.                                                                                 
  6030.  return(GFILE);                                                                 
  6031.                                                                                 
  6032. }                                                                               
  6033.                                                                                 
  6034. /*=================================================================*/           
  6035.                                                                                 
  6036. /*******************************************************************/           
  6037. /*            This routine figures out what type of parm line      */           
  6038. /*            the current line is.  We'll return the token         */           
  6039. /*            type to the caller.                                  */           
  6040. /*                                                                 */           
  6041. /*            INPUT:   buffer  pointer to first line of file       */           
  6042. /*                       (Note: string must be null terminated!    */           
  6043. /*            OUTPUT:   Type of token.  (See in include file...)   */           
  6044. /*******************************************************************/           
  6045.                                                                                 
  6046. static int                                                                      
  6047. menukeywd(char  *buffer,                                                        
  6048.           char  *token,                                                         
  6049.           char  *operand)                                                       
  6050. {                                                                               
  6051.  int             x;                              /* loop counter */             
  6052.  char           *tokval;                                                        
  6053.  char           *oprval;                                                        
  6054.  char           *tokptr;                                                        
  6055.  char            tokstr[256];                                                   
  6056.                                                                                 
  6057.  strcpy(tokstr,buffer);                                                         
  6058.  tokval=strtok(tokstr,"=");                                                     
  6059.  oprval=strtok(NULL,"");                                                        
  6060.  strcpy(token,tokval);                                                          
  6061.  strcpy(operand,oprval);                                                        
  6062.  tokptr = uppercase_and_trim_leading_space(token);                              
  6063.                                                                                 
  6064.  /*********/                                                                    
  6065.  /*  now look at the tokens to see if we have a weener... */                    
  6066.  /*********/                                                                    
  6067.                                                                                 
  6068.  if(strcmp(tokptr,TOKTYPE)==0) return(TYPETOK);                                 
  6069.  if(strcmp(tokptr,TOKNAME)==0) return(NAMETOK);                                 
  6070.  if(strcmp(tokptr,TOKPATH)==0) return(PATHTOK);                                 
  6071.  if(strcmp(tokptr,TOKHOST)==0) return(HOSTTOK);                                 
  6072.  if(strcmp(tokptr,TOKPORT)==0) return(PORTTOK);                                 
  6073.  if(strcmp(tokptr,TOKEND)==0) return(ENDTOK);                                   
  6074.                                                                                 
  6075.  /* for back compatibility with the old MVS GOPHER server */                    
  6076.                                                                                 
  6077.  if(strcmp(tokptr,TOKDISPLAY)==0) return(DISPLAYTOK);                           
  6078.  if(strcmp(tokptr,TOKSELECT)==0) return(SELECTTOK);                             
  6079.                                                                                 
  6080.  return(COMMENTTOK);                                                            
  6081.                                                                                 
  6082. }                                                                               
  6083.                                                                                 
  6084. /*=================================================================*/           
  6085.                                                                                 
  6086. /*******************************************************************/           
  6087. /*       This routine reads a line from the specified file.        */           
  6088. /*       if a read error occurs, an error message is printed and   */           
  6089. /*       FALSE is returned.                                        */           
  6090. /*                                                                 */           
  6091. /*       INPUT   buffer      pointer to buffer to place line       */           
  6092. /*               readfile    file structure to read from           */           
  6093. /*                                                                 */           
  6094. /*       OUTPUT  buffer      line that was read from the file      */           
  6095. /*               TRUE        read worked ok                        */           
  6096. /*               FALSE       read failed!                          */           
  6097. /*******************************************************************/           
  6098.                                                                                 
  6099. static Bool                                                                     
  6100. readaline(struct recvstruct *R)                                                 
  6101. {                                                                               
  6102.                                                                                 
  6103.  memset(R->buffer,0,RBUFSIZE);                                                  
  6104.  fread(R->buffer,RBUFSIZE,1,R->readfile);                                       
  6105.  if (ferror(R->readfile)) {                                                     
  6106.    /* perror("FREAD"); */                                                       
  6107.    fprintf(stderr,"GGSTASK: Error reading file\n");                             
  6108.    return(FALSE);                                                               
  6109.  }                                                                              
  6110.  trim_trailing_space(R->buffer); /* Remove trailing whitespace */               
  6111.  return(TRUE);                                                                  
  6112. }                                                                               
  6113.                                                                                 
  6114. /*=================================================================*/           
  6115.                                                                                 
  6116. /*******************************************************************/           
  6117. /*   This routine sends a file to the calling client.              */           
  6118. /*   It assumes the file is a text formatted file.                 */           
  6119. /*   INPUT:   buffer    pointer to the already read line...        */           
  6120. /*            readfile  file we're going to read from..            */           
  6121. /*            maxlen    size of the buffer.                        */           
  6122. /*            sockfd    socket descriptor for client.              */           
  6123. /*                                                                 */           
  6124. /*   OUTPUT:   send the file to the client                         */           
  6125. /*******************************************************************/           
  6126. static void                                                                     
  6127. sendafile(struct recvstruct *R)                                                 
  6128. {                                                                               
  6129.  int            x;                                                              
  6130.  char          *moveit;                                                         
  6131.                                                                                 
  6132.  /*******/                                                                      
  6133.  /*   send the first line (cause we already read it) */                         
  6134.  /*******/                                                                      
  6135.                                                                                 
  6136.  if (!GGMouts(R,R->buffer)) return;                                             
  6137.                                                                                 
  6138.  /*******/                                                                      
  6139.  /*   get the rest of the lines of the file and send them... */                 
  6140.  /*******/                                                                      
  6141.                                                                                 
  6142.  for (;;) {                                                                     
  6143.    if (!readaline(R)) {                                                         
  6144.      (void)GGMouts(R,"<<<*** I/O ERROR ON MVS FILE ***>>>");                    
  6145.      return;                                                                    
  6146.    }                                                                            
  6147.    if (feof(R->readfile)) break;                                                
  6148.    if (!GGMouts(R,R->buffer)) return;                                           
  6149.  }                                                                              
  6150. }                                                                               
  6151.                                                                                 
  6152. /*=================================================================*/           
  6153.                                                                                 
  6154. /*******************************************************************/           
  6155. /*   This routine formats a menu file into gopher data & sends it  */           
  6156. /*   to the client.                                                */           
  6157. /*   INPUT:   buffer    pointer to the already read line...        */           
  6158. /*            readfile  file we're going to read from..            */           
  6159. /*            maxlen    size of the buffer.                        */           
  6160. /*            sockfd    socket descriptor for client               */           
  6161. /*                                                                 */           
  6162. /*   OUTPUT:   send the menu to the client                         */           
  6163. /*******************************************************************/           
  6164.                                                                                 
  6165. #define MENU_STUFF_SIZE GOPHER_DESC_LENGTH + \                                  
  6166.                         GOPHER_PATH_LENGTH + \                                  
  6167.                         GOPHER_HOST_LENGTH + 20                                 
  6168.                                                                                 
  6169. static void                                                                     
  6170. sendamenu(struct recvstruct *R)                                                 
  6171. {                                                                               
  6172.  char           *moveit;                                                        
  6173.  char           *operptr;                                                       
  6174.  char           *typeoftype;             /*pointer for strtok   */              
  6175.  char           *cp;                                                            
  6176.  int             kindotoken;                                                    
  6177.  int             x;                         /* loop counter */                  
  6178.  char            token   [133];                                                 
  6179.  char            operand [133];                                                 
  6180.  char            outbuf  [MENU_STUFF_SIZE];                                     
  6181.  struct menuitem menu;                                                          
  6182.                                                                                 
  6183.  memset(&menu,0,sizeof menu );                                                  
  6184.  for (;;) {                                                                     
  6185.    if (!readaline(R)) break;                                                    
  6186.    if (feof(R->readfile)) break;                                                
  6187.    if (!*R->buffer) continue;                                                   
  6188.    kindotoken = menukeywd(R->buffer,token,operand);                             
  6189.    switch(kindotoken) {                                                         
  6190.      case TYPETOK:                                                              
  6191.           operptr = uppercase_and_trim_leading_space(operand);                  
  6192.           typeoftype = strtok(operptr," ");                                     
  6193.           if (strlen(typeoftype) == 1)      menu.type = *typeoftype;            
  6194.           else                                                                  
  6195.           if (EQUAL(typeoftype,TYPEFILE))   menu.type = GFILE;                  
  6196.           else                                                                  
  6197.           if (EQUAL(typeoftype,TYPEMENU))   menu.type = MENU;                   
  6198.           else                                                                  
  6199.           if (EQUAL(typeoftype,TYPEINDEX))  menu.type = INDEX;                  
  6200.           else                                                                  
  6201.           if (EQUAL(typeoftype,TYPETELNET)) menu.type = TELNET;                 
  6202.           else                                                                  
  6203.           if (EQUAL(typeoftype,TYPETN3270)) menu.type = TN3270;                 
  6204.           else                                                                  
  6205.           if (EQUAL(typeoftype,TYPEWHOIS))  menu.type = WHOIS;                  
  6206.           else                              menu.type = ERROR;                  
  6207.           break;                                                                
  6208.      case NAMETOK:                                                              
  6209.      case DISPLAYTOK:                                                           
  6210.           strncpy(menu.desc,     operptr, sizeof(menu.desc));                   
  6211.           break;                                                                
  6212.      case PATHTOK:                                                              
  6213.      case SELECTTOK:                                                            
  6214.           strncpy(menu.select,   operptr, sizeof(menu.select));                 
  6215.           break;                                                                
  6216.      case HOSTTOK:                                                              
  6217.           if (EQUAL(operptr,IDENT_HOST_FROB)) {  /* HOST=+  */                  
  6218.             if (insure_my_name(R)) {                                            
  6219.               strncpy(menu.hostname, R->myname, sizeof(menu.hostname));         
  6220.             }                                                                   
  6221.           }                                                                     
  6222.           else {                                                                
  6223.             strncpy(menu.hostname, operptr, sizeof(menu.hostname));             
  6224.           }                                                                     
  6225.           break;                                                                
  6226.      case PORTTOK:                                                              
  6227.           if (EQUAL(operptr,IDENT_HOST_FROB)) {  /* PORT=+  */                  
  6228.             menu.port = SERV_TCP_PORT;                                          
  6229.           }                                                                     
  6230.           else {                                                                
  6231.             menu.port=atoi(operptr);                                            
  6232.           }                                                                     
  6233.           break;                                                                
  6234.      case ENDTOK:                                                               
  6235.           if (menu.port == 0) {                                                 
  6236.             switch (menu.type) {                                                
  6237.               case TELNET: break;                                               
  6238.               case TN3270: break;                                               
  6239.               default:     menu.port = GOPHER_PORT_NUMBER; break;               
  6240.             }                                                                   
  6241.           }                                                                     
  6242.           /* If host is local and path is in the form "(member)",               
  6243.            * and current dsname is a PDS, then use same PDS:                    
  6244.            * i.e. turn PATH=(FOOBAR) into PATH=AA.BB.CC(FOOBAR)                 
  6245.            */                                                                   
  6246.           if (*R->myname                                                        
  6247.            && EQUAL(menu.hostname,R->myname)                                    
  6248.            && *menu.select == '('        /* ) */                                
  6249.            && (cp = strchr(R->dsname,'(' /* ) */ ))) {                          
  6250.             memcpy(outbuf, R->dsname, (cp-R->dsname));                          
  6251.             strcpy(outbuf+(cp-R->dsname), menu.select);                         
  6252.             strncpy(menu.select, outbuf, sizeof(menu.select));                  
  6253.           }                                                                     
  6254.           if (*menu.desc && *menu.hostname) {                                   
  6255.             sprintf(outbuf,"%c%s\t%s\t%s\t%d",                                  
  6256.                            menu.type,menu.desc,                                 
  6257.                            menu.select,menu.hostname,menu.port);                
  6258.             if (!GGMouts(R,outbuf)) return;                                     
  6259.           }                                                                     
  6260.           fflush(stdout);                                                       
  6261.           memset(&menu,0,sizeof menu );                                         
  6262.           break;                                                                
  6263.      default:                                                                   
  6264.           break;                                                                
  6265.        }                                                                        
  6266.    }                                                                            
  6267. }                                                                               
  6268.                                                                                 
  6269. /*=================================================================*/           
  6270.                                                                                 
  6271. static Bool                                                                     
  6272. get_directory(struct recvstruct *R)                                             
  6273. {                                                                               
  6274.  FILE              *dirfile;                                                    
  6275.  int                i;                                                          
  6276.  short              block_count;                                                
  6277.  short              bump_amount;                                                
  6278.  Bool               reject;                                                     
  6279.  Bool               no_more;                                                    
  6280.  char              *cp;                                                         
  6281.  char              *mp;                                                         
  6282.  char               dirblk  [256];                                              
  6283.  char               pdsspec [256];                                              
  6284.  char               entry   [256];                                              
  6285.                                                                                 
  6286.  /* The local path name is required for this function. */                       
  6287.                                                                                 
  6288.  if (!insure_my_name(R)) return FALSE;                                          
  6289.                                                                                 
  6290.  if ((dirfile=fopen(R->buffer,"rb,recfm=u,lrecl=256")) == NULL) {               
  6291.    perror(R->buffer);                                                           
  6292.    printf("Can't open PDS directory:%s\n",R->dsname);                           
  6293.    gbarf(R,"the GOPHER server can't open the directory");                       
  6294.    return(FALSE);                                                               
  6295.  }                                                                              
  6296.                                                                                 
  6297.  while (!feof(dirfile)) {                                                       
  6298.                                                                                 
  6299.    no_more = FALSE;                                                             
  6300.                                                                                 
  6301.    do {                                                                         
  6302.      memset(dirblk,0x00,256);                                                   
  6303.      fread(dirblk,256,1,dirfile);                                               
  6304.      if (feof(dirfile)) break;                                                  
  6305.      if (ferror(dirfile)) {                                                     
  6306.        printf("Can't read PDS directory:%s\n", R->fileptr);                     
  6307.        gbarf(R,"the GOPHER server can't read the directory");                   
  6308.        fclose(dirfile);                                                         
  6309.        return FALSE;                                                            
  6310.      }                                                                          
  6311.      mp = dirblk;                                                               
  6312.      block_count = *(short *)mp - 2;   /* # bytes in dir block */               
  6313.      mp += 2;                        /* addr of dir block data */               
  6314.      while (block_count > 0) {                                                  
  6315.        if (memcmp(mp,"\xff\xff\xff\xff\xff\xff\xff\xff",8)==0) break;           
  6316.        reject = FALSE;                                                          
  6317.        /*                                                                       
  6318.         * Uncomment this if you want to skip aliases.                           
  6319.         * It is recommended that you let aliases through, since                 
  6320.         * they often have better names (e.g. TSO HELP files)                    
  6321.         *                                                                       
  6322.         * if ((mp[11] & 0x80) != 0) {                                           
  6323.         *   fprintf(stderr,"Skipping alias:  %-8.8s\n",mp);                     
  6324.         *   reject = TRUE;                                                      
  6325.         * }                                                                     
  6326.         */                                                                      
  6327.        if (!reject) {                                                           
  6328.          strcpy(pdsspec, R->dsname);                                            
  6329.          cp = strchr(pdsspec, '\0');                                            
  6330.          *(cp++) = '(';                                                         
  6331.          for (i = 0; i < 8 && mp[i] != ' '; cp++, i++) *cp = mp[i];             
  6332.          *(cp++) = ')';                                                         
  6333.          *cp = '\0';                                                            
  6334.          sprintf(entry,"0%8.8s\t%s\t%s\t%d",                                    
  6335.                        mp, pdsspec, R->myname, SERV_TCP_PORT);                  
  6336.          (void)GGMouts(R,entry);                                                
  6337.        }                                                                        
  6338.        bump_amount = 12 + ((mp[11] & 0x1f) * 2);                                
  6339.        mp += bump_amount;                                                       
  6340.        block_count -= bump_amount;                                              
  6341.      }                                                                          
  6342.    } while(!no_more);                                                           
  6343.                                                                                 
  6344.  }                                                                              
  6345.                                                                                 
  6346.  fclose(dirfile);                                                               
  6347.  return TRUE;                                                                   
  6348. }                                                                               
  6349.                                                                                 
  6350. /*=================================================================*/           
  6351.                                                                                 
  6352. static Bool                                                                     
  6353. get_flat_file(struct recvstruct *R)                                             
  6354. {                                                                               
  6355.  int                x;            /* loop counter*/                             
  6356.  int                numread;      /* number of items read... */                 
  6357.  char               filetype;     /* type of file we're dealing with*/          
  6358.                                                                                 
  6359.  if ((R->readfile=fopen(R->buffer,"rb,type=record")) == NULL) {                 
  6360.    perror(R->buffer);                                                           
  6361.    printf("INVALID! requested:%s\n",R->fileptr);                                
  6362.    gbarf(R,"the GOPHER server couldn't open the file");                         
  6363.    return(FALSE);                                                               
  6364.  }                                                                              
  6365.                                                                                 
  6366.  /************/                                                                 
  6367.  /*  get the first line and see what type of file we've got.      */            
  6368.  /************/                                                                 
  6369.                                                                                 
  6370.  if (readaline(R) && !feof(R->readfile)) {                                      
  6371.                                                                                 
  6372.    filetype=getftype(R->buffer);                                                
  6373.                                                                                 
  6374.   /************/                                                                
  6375.   /*  Now let's go do whatever we need to for this file type.    */             
  6376.   /************/                                                                
  6377.                                                                                 
  6378.    switch(filetype) {                                                           
  6379.      case MENU:                                                                 
  6380.                  sendamenu(R);                                                  
  6381.                  break;                                                         
  6382.      case GFILE:                                                                
  6383.      default:                                                                   
  6384.                  sendafile(R);                                                  
  6385.                  break;                                                         
  6386.    }                                                                            
  6387.                                                                                 
  6388.  }                                                                              
  6389.                                                                                 
  6390.  if(fclose(R->readfile) < 0) {                                                  
  6391.    /* perror("PROCESS CLOSE"); */                                               
  6392.    fprintf(stderr,"GGSTASK: Error closing file %s\n",R->fileptr);               
  6393.    gbarf(R,"the GOPHER server couldn't close the file");                        
  6394.    return FALSE;                                                                
  6395.  }                                                                              
  6396.                                                                                 
  6397.  return TRUE;                                                                   
  6398.                                                                                 
  6399. }                                                                               
  6400.                                                                                 
  6401. /*=================================================================*/           
  6402.                                                                                 
  6403. #define PARAMETER   unsigned int                                                
  6404. #define LASTPARM(X) ((unsigned int)(X) | 0x80000000)                            
  6405.                                                                                 
  6406.                                                                                 
  6407. static Bool                                                                     
  6408. get_exec_data(struct recvstruct *R)                                             
  6409. {                                                                               
  6410.  char              *command;                                                    
  6411.  char              *commandargs;                                                
  6412.  unsigned int       bitflags;                                                   
  6413.  int                rexxrc;                                                     
  6414.  int                irxexecrc;                                                  
  6415.  int                commandlength;                                              
  6416.  int                scan_count;                                                 
  6417.  int                i;                                                          
  6418.  Bool               rc;                                                         
  6419.  int              (*irxexec)();                                                 
  6420.  FILE              *fp;                                                         
  6421.  char               exectest[RBUFSIZE];                                         
  6422.  PARAMETER          parameter[11];                                              
  6423.  struct {                                                                       
  6424.                          /* repeat this block for each argument */              
  6425.          char      *argstring_ptr;                                              
  6426.          int        argstring_length;                                           
  6427.                          /* end repeat this block for each argument */          
  6428.          int        argstring_end;                                              
  6429.         }           arguments;                                                  
  6430.                                                                                 
  6431.  struct {                                                                       
  6432.          char       acryn[8];       /* "IRXEXECB" */                            
  6433.          int        length;                                                     
  6434.          int        reserved1;                                                  
  6435.          char       member[8];                                                  
  6436.          char       ddname[8];                                                  
  6437.          char       subcom[8];                                                  
  6438.          char      *dsnptr;                                                     
  6439.          int        dsnlen;                                                     
  6440.         }           execblk;                                                    
  6441.                                                                                 
  6442.   /*                                                                            
  6443.    * Menu item should look like this:                                           
  6444.    *                                                                            
  6445.    * exec:rexxname any args                                                     
  6446.    *                                                                            
  6447.    * The exec should write output to SYSTSPRT.  Normal TSO command              
  6448.    * output will be captured by the SYSTSPRT allocation only if                 
  6449.    * the Gopher server is run as a batch job.                                   
  6450.    *                                                                            
  6451.    * If this was sent by the client with a type 7 or type w, then               
  6452.    * additional args will appear at the end delimited by a space.               
  6453.    */                                                                           
  6454.                                                                                 
  6455.  irxexec = NULL;                                                                
  6456.  rc = TRUE;                                                                     
  6457.  scan_count = 0;                                                                
  6458.                                                                                 
  6459.  if (R->wargptr) {                                                              
  6460.    commandlength = strlen(R->fileptr) + strlen(R->wargptr) + 4;                 
  6461.    command = (char *)malloc(commandlength);                                     
  6462.    if (!command) {                                                              
  6463.      printf("Cannot allocate %d bytes of memory for exec\n",                    
  6464.             commandlength);                                                     
  6465.      gbarf(R,"the GOPHER server ran out of memory");                            
  6466.      return FALSE;                                                              
  6467.    }                                                                            
  6468.    else sprintf(command,"%s %s",R->fileptr,R->wargptr);                         
  6469.  }                                                                              
  6470.  else {                                                                         
  6471.    commandlength = 0;                                                           
  6472.    command = R->fileptr;                                                        
  6473.  }                                                                              
  6474.                                                                                 
  6475.  *exectest = '\0';                                                              
  6476.  sscanf(command, "%s %n", exectest, &scan_count);                               
  6477.  if (strlen(exectest) > 8) {                                                    
  6478.    gbarf(R,"name of exec is too long");                                         
  6479.    return FALSE;                                                                
  6480.  }                                                                              
  6481.  commandargs = command + scan_count;                                            
  6482.                                                                                 
  6483.  if (rc) {                                                                      
  6484.    irxexec = (int(*)())fetch("IRXEXEC");                                        
  6485.    if (!irxexec) {                                                              
  6486.      printf("Cannot fetch IRXEXEC\n");                                          
  6487.      rc = FALSE;                                                                
  6488.    }                                                                            
  6489.  }                                                                              
  6490.                                                                                 
  6491.  /* Give the exec an empty SYSTSPRT file to write into.                         
  6492.   * Then when we read it we can see only what was added.                        
  6493.   * Since IRXEXEC doesn't close SYSTSPRT, we can't remove it                    
  6494.   * and reallocate it.                                                          
  6495.   */                                                                            
  6496.                                                                                 
  6497.  if (rc) {                                                                      
  6498.    fp = fopen("DD:SYSTSPRT","w");                                               
  6499.    if (!fp) {                                                                   
  6500.      perror("DD:SYSTSPRT");                                                     
  6501.      printf("Cannot open SYSTSPRT to prepare for REXX exec\n");                 
  6502.      rc = FALSE;                                                                
  6503.    }                                                                            
  6504.                                                                                 
  6505.    /* Open for write + close = clear it out */                                  
  6506.                                                                                 
  6507.    else if (fclose(fp) < 0) {                                                   
  6508.      printf("Cannot close SYSTSPRT to prepare for REXX exec\n");                
  6509.      rc = FALSE;                                                                
  6510.    }                                                                            
  6511.  }                                                                              
  6512.                                                                                 
  6513.  /* Set up parameters for IRXEXEC:                                              
  6514.   *                                                                             
  6515.   * Param 1  -  address of EXECBLK                                              
  6516.   * Param 2  -  address of arguments                                            
  6517.   * Param 3  -  bitflags                                                        
  6518.   * Param 4  -  address of INSTBLK                                              
  6519.   * Param 5  -  address of CPPL                                                 
  6520.   * Param 6  -  address of EVALBLOCK                                            
  6521.   * Param 7  -  address of 8-byte work area                                     
  6522.   * Param 8  -  address of user field                                           
  6523.   * Param 9  -  address of environment block                                    
  6524.   * Param 10 -  return code                                                     
  6525.   *                                                                             
  6526.   */                                                                            
  6527.                                                                                 
  6528.  if (rc) {                                                                      
  6529.                                                                                 
  6530.    /* set up exec block */                                                      
  6531.                                                                                 
  6532.    memset (&execblk, 0, sizeof(execblk));                                       
  6533.    execblk.length = sizeof(execblk);                                            
  6534.    memcpy (execblk.acryn, "IRXEXECB", 8);                                       
  6535.    strncpy(execblk.member,exectest,8);                                          
  6536.    for (i=0;i<8;i++) {                                                          
  6537.      if (execblk.member[i] == '\0')                                             
  6538.          execblk.member[i] = ' ';                                               
  6539.    }                                                                            
  6540.    /* We may have just clobbered this, so do this after... */                   
  6541.                                                                                 
  6542.    memcpy (execblk.ddname, REXX_EXEC_LIBRARY_DDNAME, 8);                        
  6543.    memcpy (execblk.subcom, REXX_EXEC_SUBCOM,     8);                            
  6544.                                                                                 
  6545.    /* set up arguments  */                                                      
  6546.                                                                                 
  6547.    arguments.argstring_ptr    = commandargs;                                    
  6548.    arguments.argstring_length = strlen(commandargs);                            
  6549.    arguments.argstring_end    = 0xffffffff;                                     
  6550.                                                                                 
  6551.    /* Invoke the rexx exec */                                                   
  6552.                                                                                 
  6553.    if (!R->outfp) printf("Executing:%s\n", command);                            
  6554.                                                                                 
  6555. #define INVOKE_EXEC_AS_COMMAND            (unsigned int)0x80000000              
  6556. #define INVOKE_EXEC_AS_EXTERNAL_FUNCTION  (unsigned int)0x40000000              
  6557. #define INVOKE_EXEC_AS_SUBROUTINE         (unsigned int)0x20000000              
  6558. #define RETURN_EXTENDED_RETURN_CODES      (unsigned int)0x10000000              
  6559.                                                                                 
  6560.    rexxrc = 0;                                                                  
  6561.    bitflags = (unsigned int)(INVOKE_EXEC_AS_COMMAND +                           
  6562.                              RETURN_EXTENDED_RETURN_CODES);                     
  6563.                                                                                 
  6564.    parameter[ 1] =   (PARAMETER)&execblk;                                       
  6565.    parameter[ 2] =   (PARAMETER)&arguments;                                     
  6566.    parameter[ 3] =   (PARAMETER)bitflags;                                       
  6567.    parameter[ 4] =   (PARAMETER)NULL;  /* no INSTBLK */                         
  6568.    parameter[ 5] =   (PARAMETER)NULL;  /* no CPPL    */                         
  6569.    parameter[ 6] =   (PARAMETER)NULL;  /* no eval block */                      
  6570.    parameter[ 7] =   (PARAMETER)NULL;  /* no work area */                       
  6571.    parameter[ 8] =   (PARAMETER)NULL;  /* no user field, last parm */           
  6572.    parameter[ 9] =   (PARAMETER)NULL;  /* no environment block */               
  6573.    parameter[10] =   (PARAMETER)0;     /* return code */                        
  6574.                                                                                 
  6575.    irxexecrc = (*irxexec) (                                                     
  6576.                            ¶meter[1],                                       
  6577.                            ¶meter[2],                                       
  6578.                            ¶meter[3],                                       
  6579.                            ¶meter[4],                                       
  6580.                            ¶meter[5],                                       
  6581.                            ¶meter[6],                                       
  6582.                            ¶meter[7],                                       
  6583.                            LASTPARM(¶meter[8]), /* old REXX */              
  6584.                            ¶meter[9],                                       
  6585.                            LASTPARM(¶meter[10]) /* new REXX */              
  6586.                           );                                                    
  6587.                                                                                 
  6588.    if (irxexecrc != 0) {                                                        
  6589.      fprintf(stderr,"Return code from IRXEXEC is %d\n", irxexecrc);             
  6590.      gbarf(R,"the Gopher server was unable to run the exec");                   
  6591.      rc = FALSE;                                                                
  6592.    }                                                                            
  6593.    else {                                                                       
  6594.                                                                                 
  6595.      rexxrc = parameter[10];                                                    
  6596.                                                                                 
  6597.      if (!R->outfp) printf("Return code from exec is %d\n", rexxrc);            
  6598.                                                                                 
  6599.      /* Read what the exec wrote. */                                            
  6600.                                                                                 
  6601.      strcpy(R->buffer,"DD:SYSTSPRT");                                           
  6602.      R->fileptr = R->buffer;                                                    
  6603.      rc = get_flat_file(R);                                                     
  6604.                                                                                 
  6605.    }                                                                            
  6606.                                                                                 
  6607.  }                                                                              
  6608.                                                                                 
  6609.  else {                                                                         
  6610.      gbarf(R,"the GOPHER server had a problem with the exec");                  
  6611.  }                                                                              
  6612.                                                                                 
  6613.  if (irxexec) release((void (*)())irxexec);                                     
  6614.                                                                                 
  6615.  if (commandlength > 0) free(command);                                          
  6616.                                                                                 
  6617.  return rc;                                                                     
  6618.                                                                                 
  6619. }                                                                               
  6620.                                                                                 
  6621. /*=================================================================*/           
  6622.                                                                                 
  6623. /*******************************************************************/           
  6624. /*   This routine Processes the file the user requested.           */           
  6625. /*   If it's a menu, we'll form a menu line, if it's a             */           
  6626. /*   file, we'll just send it as is.                               */           
  6627. /*                                                                 */           
  6628. /*   INPUT:   filename  pointer to the file name to open           */           
  6629. /*            sockfd    socket descriptor for the client           */           
  6630. /*                                                                 */           
  6631. /*   OUTPUT:   print "gopher" lines.                               */           
  6632. /*             TRUE  - file printed ok.                            */           
  6633. /*             FALSE - Error reading or writing                    */           
  6634. /*******************************************************************/           
  6635.                                                                                 
  6636. Bool                                                                            
  6637. GGMproc(struct recvstruct *R)                                                   
  6638. {                                                                               
  6639.  int                x;            /* loop counter*/                             
  6640.  int                numread;      /* number of items read... */                 
  6641.  int                hacksize;     /* length of hack prefix before : */          
  6642.  Bool               rc;           /* return value */                            
  6643.  enum data_set_type dstype;       /* SEQ, PDS or UNK */                         
  6644.  char              *p;                                                          
  6645.  char              *q;                                                          
  6646.  char              *tabptr;                                                     
  6647.  char              *colonptr;                                                   
  6648.  char               ddname    [  9];                                            
  6649.  char               hackprefix[ 17];                                            
  6650.                                                                                 
  6651.  *ddname     = '\0';                                                            
  6652.  *hackprefix = '\0';                                                            
  6653.                                                                                 
  6654.  /************/                                                                 
  6655.  /*  First, strip off any "bad" characters from the arguments. */               
  6656.  /************/                                                                 
  6657.                                                                                 
  6658.  /*                                                                             
  6659.   * Break the argument up into one or two pieces delimited by tab.              
  6660.   */                                                                            
  6661.                                                                                 
  6662.  R->fileptr = R->buffer;        /* filename passed in buffer */                 
  6663.                                                                                 
  6664.  tabptr = strchr(R->fileptr,'\t');                                              
  6665.  if (tabptr) {                                                                  
  6666.    *tabptr = '\0';                                                              
  6667.    R->fileptr = trim_leading_and_trailing_space(R->fileptr);                    
  6668.    R->wargptr = trim_leading_and_trailing_space(tabptr+1);                      
  6669.  }                                                                              
  6670.  else {                                                                         
  6671.    R->fileptr = trim_leading_and_trailing_space(R->fileptr);                    
  6672.    R->wargptr = NULL;                                                           
  6673.  }                                                                              
  6674.                                                                                 
  6675.  if (!*R->fileptr) {                                                            
  6676.    R->fileptr = DEFAULT_DIRECTORY;                                              
  6677.  }                                                                              
  6678.                                                                                 
  6679.  /* If first character is numeric, assume it's a gopher type.                   
  6680.   * Later we will actually support different types...                           
  6681.   */                                                                            
  6682.                                                                                 
  6683.  switch (*R->fileptr) {                                                         
  6684.    case '0':                                                                    
  6685.    case '1':                                                                    
  6686.    case '2':                                                                    
  6687.    case '3':                                                                    
  6688.    case '4':                                                                    
  6689.    case '5':                                                                    
  6690.    case '6':                                                                    
  6691.    case '7':                                                                    
  6692.    case '8':                                                                    
  6693.    case '9':  R->fileptr++; break;                                              
  6694.    default:                 break;                                              
  6695.  }                                                                              
  6696.                                                                                 
  6697.  if (!R->outfp) printf("%s: requested:%s;\n",R->hostname,R->fileptr);           
  6698.                                                                                 
  6699.  /*                                                                             
  6700.   * Process special hacks here.                                                 
  6701.   *                                                                             
  6702.   * For example, if the file name begins with "exec:", then                     
  6703.   * execute the specified REXX exec.                                            
  6704.   *                                                                             
  6705.   * Hackless names are processed as files.  "dd:" is not a                      
  6706.   * special hack but the normal C/370 DDname reference.                         
  6707.   *                                                                             
  6708.   */                                                                            
  6709.                                                                                 
  6710.  colonptr = strchr(R->fileptr,':');                                             
  6711.  if (colonptr) {                                                                
  6712.    hacksize = colonptr - R->fileptr;                                            
  6713.    if (hacksize > 0 && hacksize < sizeof(hackprefix)) {                         
  6714.      for (p = hackprefix, q = R->fileptr;                                       
  6715.           hacksize > 0;                                                         
  6716.           p++, q++, hacksize--) *p = toupper(*q);                               
  6717.      *p = '\0';                                                                 
  6718.    }                                                                            
  6719.  }                                                                              
  6720.                                                                                 
  6721.  if (EQUAL(hackprefix,"EXEC")) {                                                
  6722.   /*                                                                            
  6723.    * REXX exec, which must reside in SYSEXEC DD.                                
  6724.    */                                                                           
  6725.    if (!authorized_file(R)) {                                                   
  6726.      gbarf(R,"the GOPHER server won't run the exec for you");                   
  6727.      rc = FALSE;                                                                
  6728.    }                                                                            
  6729.    else {                                                                       
  6730.      R->fileptr = colonptr + 1;  /* point to exec itself */                     
  6731.      rc = get_exec_data(R);                                                     
  6732.    }                                                                            
  6733.  }                                                                              
  6734.  else                                                                           
  6735.  if (EQUAL(hackprefix,"DD")) {                                                  
  6736.   /*                                                                            
  6737.    * C/370 style ddname.  Assume sequential file - cannot be a PDS              
  6738.    * because I don't feel like trying to determine that right now.              
  6739.    */                                                                           
  6740.    if (!authorized_file(R)) {                                                   
  6741.      gbarf(R,"the GOPHER server won't read the DD for you");                    
  6742.      rc = FALSE;                                                                
  6743.    }                                                                            
  6744.    else {                                                                       
  6745.      strcpy(R->buffer,R->fileptr); /* still points to "DD:xxxxxxxx" */          
  6746.      dstype = SEQ;                                                              
  6747.      rc = get_flat_file(R);                                                     
  6748.    }                                                                            
  6749.  }                                                                              
  6750.  else {                                                                         
  6751.    /* Regular file name without ":" hack, or with invalid ":" hack.             
  6752.     * Check to see that the file name is on our "official" list.                
  6753.     */                                                                          
  6754.    if (!authorized_file(R)) {                                                   
  6755.      gbarf(R,"the GOPHER server won't let you see the file");                   
  6756.      rc = FALSE;                                                                
  6757.    }                                                                            
  6758.    else {                                                                       
  6759.                                                                                 
  6760.    /* Dynamically allocate data set and use generated ddname.                   
  6761.     * Note that we have to allocate the data set name to a ddname and           
  6762.     * then open the ddname to prevent C/370 from barfing on otherwise           
  6763.     * valid data set names like those with hyphens in them.  But this           
  6764.     * also lets us determine if the data set is sequential or a PDS.            
  6765.     */                                                                          
  6766.      strcpy(R->dsname,R->fileptr);                                              
  6767.      dstype = GGMalloc(R->dsname,ddname,UNK,0);                                 
  6768.      sprintf(R->buffer,"DD:%s",ddname);                                         
  6769.      switch (dstype) {                                                          
  6770.        case SEQ: rc = get_flat_file(R); break;                                  
  6771.        case PDS: rc = get_directory(R); break;                                  
  6772.        default:                                                                 
  6773.                printf("INVALID! requested:%s\n",R->fileptr);                    
  6774.                gbarf(R,"the GOPHER server couldn't allocate the file");         
  6775.                rc = FALSE;                                                      
  6776.      }                                                                          
  6777.    }                                                                            
  6778.  }                                                                              
  6779.                                                                                 
  6780.  GGMunalc(ddname);  /* free the ddname if set */                                
  6781.                                                                                 
  6782.  if (!rc) {                                                                     
  6783.    fflush(stdout);                                                              
  6784.    fflush(stderr);                                                              
  6785.  }                                                                              
  6786.                                                                                 
  6787.  return rc;                                                                     
  6788.                                                                                 
  6789. }                                                                               
  6790.                                                                                 
  6791. ./   ADD NAME=GGMPTX,SSI=01000029                                               
  6792.                                                                                 
  6793.  /********************************************************************/         
  6794.  /*                                                                  */         
  6795.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6796.  /*                                                                  */         
  6797.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6798.  /*                                                                  */         
  6799.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6800.  /* including the implied warranties of merchantability and fitness, */         
  6801.  /* are expressly denied.                                            */         
  6802.  /*                                                                  */         
  6803.  /* Provided this copyright notice is included, this software may    */         
  6804.  /* be freely distributed and not offered for sale.                  */         
  6805.  /*                                                                  */         
  6806.  /* Changes or modifications may be made and used only by the maker  */         
  6807.  /* of same, and not further distributed.  Such modifications should */         
  6808.  /* be mailed to the author for consideration for addition to the    */         
  6809.  /* software and incorporation in subsequent releases.               */         
  6810.  /*                                                                  */         
  6811.  /********************************************************************/         
  6812.                                                                                 
  6813. #pragma  csect(code,  "GG@PTX  ")                                               
  6814. #pragma  csect(static,"GG$PTX  ")                                               
  6815. #include "gg.h"                                                                 
  6816.                                                                                 
  6817. /****** Print the lines of server text. ******************************/         
  6818.                                                                                 
  6819. void                                                                            
  6820. GGMptx(gp,ip)                                                                   
  6821. Rstruc ggcb         *gp;                                                        
  6822. Rstruc gopherinfo   *ip;                                                        
  6823. {                                                                               
  6824.  FILE               *pfp;                                                       
  6825.  struct texthdr     *thp;                                                       
  6826.  struct textline    *tp;                                                        
  6827.                                                                                 
  6828.  thp = (ip ? &ip->thdr : &gp->thdr);                                            
  6829.                                                                                 
  6830.  pfp = stdout;                                                                  
  6831.                                                                                 
  6832.  /* Article must be specified (cannot be null). */                              
  6833.                                                                                 
  6834.  for (tp=thp->first_text_line;tp;tp=tp->next) {                                 
  6835.    if (tp->text_length >= 0) {                                                  
  6836.      char *p = tp->tab_expanded_text;                                           
  6837.      while (*p) {                                                               
  6838.        if isprint(*p) fprintf(pfp,"%c",*p);                                     
  6839.        else fprintf(pfp,"?");                                                   
  6840.        p++;                                                                     
  6841.      }                                                                          
  6842.      fprintf(pfp,"\n");                                                         
  6843.    }                                                                            
  6844.  }                                                                              
  6845.  fprintf(pfp,"\n");                                                             
  6846.                                                                                 
  6847.  return;                                                                        
  6848.                                                                                 
  6849. }                                                                               
  6850.                                                                                 
  6851. ./   ADD NAME=GGMSOCKT,SSI=010B0052                                             
  6852.                                                                                 
  6853.  /********************************************************************/         
  6854.  /*                                                                  */         
  6855.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6856.  /*                                                                  */         
  6857.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6858.  /*                                                                  */         
  6859.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6860.  /* including the implied warranties of merchantability and fitness, */         
  6861.  /* are expressly denied.                                            */         
  6862.  /*                                                                  */         
  6863.  /* Provided this copyright notice is included, this software may    */         
  6864.  /* be freely distributed and not offered for sale.                  */         
  6865.  /*                                                                  */         
  6866.  /* Changes or modifications may be made and used only by the maker  */         
  6867.  /* of same, and not further distributed.  Such modifications should */         
  6868.  /* be mailed to the author for consideration for addition to the    */         
  6869.  /* software and incorporation in subsequent releases.               */         
  6870.  /*                                                                  */         
  6871.  /********************************************************************/         
  6872.                                                                                 
  6873. #pragma  csect(code,  "GG@SOCKT")                                               
  6874. #pragma  csect(static,"GG$SOCKT")                                               
  6875. #include "gg.h"                                                                 
  6876.                                                                                 
  6877. /****** Output one data line for the server. *************************/         
  6878.                                                                                 
  6879. Bool                                                                            
  6880. GGMsockt(gp)                                                                    
  6881. Rstruc ggcb        *gp;                                                         
  6882. {                                                                               
  6883.  int                gopher_bytes;                                               
  6884.  int                writrc;                                                     
  6885.  char              *s_buf;                                                      
  6886.  Bool               procok;                                                     
  6887.  struct recvstruct *R;                                                          
  6888.                                                                                 
  6889.  /* Before sending a request to the server, do a cleanup operation              
  6890.   * to make sure that no more responses are coming from the server.             
  6891.   */                                                                            
  6892.                                                                                 
  6893.  GGMesrvr(gp);           /* End server read */                                  
  6894.                                                                                 
  6895.  /* If local mode, call server subtask processor with command. */               
  6896.                                                                                 
  6897.  if ((R=gp->recvp)) {                                                           
  6898.    if (!R->outfp) {                                                             
  6899.      CRIT1("Can't send data locally, non-socket not connected");                
  6900.      return FALSE;                                                              
  6901.    }                                                                            
  6902.    strncpy(R->buffer, gp->gopher_command, sizeof(R->buffer)-1);                 
  6903.    strcpy(R->myname, LOCAL_HOST_FROB);  /* used by PDS feature */               
  6904.                                                                                 
  6905.    /* allocate SYSTSPRT file, used by REXX EXEC interface */                    
  6906.                                                                                 
  6907.    if (GGMtso(                                                                  
  6908.      "ALLOC FI(SYSTSPRT) T SP(100 100) REL REU DEL"                             
  6909.      " RECFM(V B) LRECL(1024) BLKSIZE(32760)"                                   
  6910.              ) != 0) {                                                          
  6911.      fprintf(stderr,                                                            
  6912.        "Warning: Cannot allocate temporary SYSTSPRT file.\n");                  
  6913.      fprintf(stderr,                                                            
  6914.        "         Some interfaces may not work properly.\n");                    
  6915.    }                                                                            
  6916.                                                                                 
  6917.    procok = GGMproc(R);                                                         
  6918.                                                                                 
  6919.    /* free SYSTSPRT file, used by REXX EXEC interface */                        
  6920.                                                                                 
  6921.    (void)GGMunalc("SYSTSPRT");                                                  
  6922.                                                                                 
  6923.    /* Prepare to read from the beginning of the file */                         
  6924.                                                                                 
  6925.    if (fseek(R->outfp, 0, SEEK_SET) != 0) {                                     
  6926.      CRIT1("Can't reposition to start of local file");                          
  6927.      return FALSE;                                                              
  6928.    }                                                                            
  6929.    return procok;                                                               
  6930.  }                                                                              
  6931.                                                                                 
  6932.  gopher_bytes = strlen(gp->gopher_command);                                     
  6933.                                                                                 
  6934.  memcpy(gp->client_buf,gp->gopher_command,gopher_bytes);                        
  6935.  gp->client_buf[gopher_bytes]   = CARRIAGE_RETURN;                              
  6936.  gp->client_buf[gopher_bytes+1] = LINE_FEED;                                    
  6937.                                                                                 
  6938.  if (gp->receiving_text &&                                                      
  6939.      gopher_bytes == 1  &&                                                      
  6940.      gp->client_buf[0] == '.') {                                                
  6941.    gp->receiving_text = FALSE;                                                  
  6942.  }                                                                              
  6943.                                                                                 
  6944.  if (gp->debug_mode)                                                            
  6945.     GGMdump(gp,"Writing to server",gp->client_buf,gopher_bytes+2);              
  6946.                                                                                 
  6947. #ifdef MVS                                                                      
  6948.  EBCDIC_TO_ASCII(gp->client_buf,gopher_bytes+2);                                
  6949. #endif                                                                          
  6950.                                                                                 
  6951.  writrc = write(gp->socknum, gp->client_buf, gopher_bytes+2);                   
  6952.  if (writrc < 0) {                                                              
  6953.    gp->connection_broken = TRUE;                                                
  6954.    CRIT2("TCP/IP error: write() failed to send data to server %s.",             
  6955.          gp->ggserver);                                                         
  6956.    return FALSE;                                                                
  6957.  }                                                                              
  6958.                                                                                 
  6959.  /* Prepare server for read. */                                                 
  6960.                                                                                 
  6961.  gp->server_has_something_pending = TRUE;                                       
  6962.  gp->server_finished_replying     = FALSE;                                      
  6963.  gp->sending_text                 = FALSE;                                      
  6964.  gp->dont_read                    = FALSE;                                      
  6965.                                                                                 
  6966.  return TRUE;                                                                   
  6967. }                                                                               
  6968.                                                                                 
  6969. ./   ADD NAME=GGMSOPT,SSI=01000036                                              
  6970.                                                                                 
  6971.  /********************************************************************/         
  6972.  /*                                                                  */         
  6973.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  6974.  /*                                                                  */         
  6975.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  6976.  /*                                                                  */         
  6977.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  6978.  /* including the implied warranties of merchantability and fitness, */         
  6979.  /* are expressly denied.                                            */         
  6980.  /*                                                                  */         
  6981.  /* Provided this copyright notice is included, this software may    */         
  6982.  /* be freely distributed and not offered for sale.                  */         
  6983.  /*                                                                  */         
  6984.  /* Changes or modifications may be made and used only by the maker  */         
  6985.  /* of same, and not further distributed.  Such modifications should */         
  6986.  /* be mailed to the author for consideration for addition to the    */         
  6987.  /* software and incorporation in subsequent releases.               */         
  6988.  /*                                                                  */         
  6989.  /********************************************************************/         
  6990.                                                                                 
  6991. #pragma  csect(code,  "GG@SOPT ")                                               
  6992. #pragma  csect(static,"GG$SOPT ")                                               
  6993. #include "gg.h"                                                                 
  6994.                                                                                 
  6995. #define BOOLOPTSET(A,B,C) \                                                     
  6996.    switch (A[0]) { \                                                            
  6997.      case  'n': \                                                               
  6998.      case  'N':   B = FALSE; break; \                                           
  6999.      case  'y': \                                                               
  7000.      case  'Y':   B = TRUE; break; \                                            
  7001.      case '\0': \                                                               
  7002.      default:     B = C; break; \                                               
  7003.    }                                                                            
  7004.                                                                                 
  7005. /****** Set options that are stored in ISPF profile. *****************/         
  7006.                                                                                 
  7007. void                                                                            
  7008. GGMsopt(gp,which)                                                               
  7009. Rstruc ggcb        *gp;                                                         
  7010. enum user_option    which;                                                      
  7011. {                                                                               
  7012.  int                arrows;                                                     
  7013.  char               ggextpow[  4];                                              
  7014.  char               ggextpap[  4];                                              
  7015.  char               ggscroll[  4];                                              
  7016.                                                                                 
  7017.  if (which == OPTION_ALL) {                                                     
  7018.    GGMispf(gp, "VGET (GGMUPDTF GGEXTPOW GGEXTPOP GGSCROLL) PROFILE");           
  7019.  }                                                                              
  7020.                                                                                 
  7021.  if (which == OPTION_ALL || which == OPTION_OTHER) {                            
  7022.                                                                                 
  7023.    (void)GGMivget(gp,"GGEXTPOW ", ggextpow, sizeof(ggextpow));                  
  7024.    (void)GGMivget(gp,"GGEXTPAP ", ggextpap, sizeof(ggextpap));                  
  7025.                                                                                 
  7026.    BOOLOPTSET(ggextpow, gp->warn_overwrite,              TRUE);                 
  7027.    BOOLOPTSET(ggextpap, gp->warn_append,                 TRUE);                 
  7028.                                                                                 
  7029.  }                                                                              
  7030.                                                                                 
  7031.  if (which == OPTION_ALL || which == OPTION_VIEW) {                             
  7032.                                                                                 
  7033.    (void)GGMivget(gp,"GGSCROLL ", ggscroll, sizeof(ggscroll));                  
  7034.                                                                                 
  7035.    BOOLOPTSET(ggscroll, gp->autoscroll, TRUE);                                  
  7036.                                                                                 
  7037.  }                                                                              
  7038.                                                                                 
  7039.  return;                                                                        
  7040. }                                                                               
  7041.                                                                                 
  7042. ./   ADD NAME=GGMSSRVR,SSI=01010032                                             
  7043.                                                                                 
  7044.  /********************************************************************/         
  7045.  /*                                                                  */         
  7046.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7047.  /*                                                                  */         
  7048.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7049.  /*                                                                  */         
  7050.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7051.  /* including the implied warranties of merchantability and fitness, */         
  7052.  /* are expressly denied.                                            */         
  7053.  /*                                                                  */         
  7054.  /* Provided this copyright notice is included, this software may    */         
  7055.  /* be freely distributed and not offered for sale.                  */         
  7056.  /*                                                                  */         
  7057.  /* Changes or modifications may be made and used only by the maker  */         
  7058.  /* of same, and not further distributed.  Such modifications should */         
  7059.  /* be mailed to the author for consideration for addition to the    */         
  7060.  /* software and incorporation in subsequent releases.               */         
  7061.  /*                                                                  */         
  7062.  /********************************************************************/         
  7063.                                                                                 
  7064. #pragma  csect(code,  "GG@SSRVR")                                               
  7065. #pragma  csect(static,"GG$SSRVR")                                               
  7066. #include "gg.h"                                                                 
  7067.                                                                                 
  7068. /****** Start server read. *******************************************/         
  7069.                                                                                 
  7070. void                                                                            
  7071. GGMssrvr(gp)                                                                    
  7072. Rstruc ggcb  *gp;                                                               
  7073. {                                                                               
  7074.                                                                                 
  7075.  gp->server_has_something_pending = TRUE;                                       
  7076.  gp->server_finished_replying     = FALSE;                                      
  7077.  gp->sending_text                 = FALSE;                                      
  7078.  gp->dont_read                    = FALSE;                                      
  7079.                                                                                 
  7080.  return;                                                                        
  7081.                                                                                 
  7082. }                                                                               
  7083.                                                                                 
  7084. ./   ADD NAME=GGMTNET,SSI=01050009                                              
  7085.                                                                                 
  7086.  /********************************************************************/         
  7087.  /*                                                                  */         
  7088.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7089.  /*                                                                  */         
  7090.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7091.  /*                                                                  */         
  7092.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7093.  /* including the implied warranties of merchantability and fitness, */         
  7094.  /* are expressly denied.                                            */         
  7095.  /*                                                                  */         
  7096.  /* Provided this copyright notice is included, this software may    */         
  7097.  /* be freely distributed and not offered for sale.                  */         
  7098.  /*                                                                  */         
  7099.  /* Changes or modifications may be made and used only by the maker  */         
  7100.  /* of same, and not further distributed.  Such modifications should */         
  7101.  /* be mailed to the author for consideration for addition to the    */         
  7102.  /* software and incorporation in subsequent releases.               */         
  7103.  /*                                                                  */         
  7104.  /********************************************************************/         
  7105.                                                                                 
  7106. #pragma  csect(code,  "GG@TNET ")                                               
  7107. #pragma  csect(static,"GG$TNET ")                                               
  7108. #include "gg.h"                                                                 
  7109.                                                                                 
  7110. /****** Gopher TELNET interface. *************************************/         
  7111.                                                                                 
  7112. Bool                                                                            
  7113. GGMtnet(gp,ip,as_file)                                                          
  7114. Rstruc ggcb        *gp;                                                         
  7115. Rstruc gopherinfo  *ip;                                                         
  7116. Fool                as_file;                                                    
  7117. {                                                                               
  7118.  int                tsorc;                                                      
  7119.  char               tsocmd[256];                                                
  7120.                                                                                 
  7121.  if (as_file) {                                                                 
  7122.    ERR1("TELNET interface cannot be viewed as a file.");                        
  7123.    return FALSE;                                                                
  7124.  }                                                                              
  7125.                                                                                 
  7126.  GGMispf(gp,"CONTROL DISPLAY LINE");                                            
  7127.                                                                                 
  7128.  fprintf(stderr,"Note: Login as user: %s\n\n", ip->path);                       
  7129.                                                                                 
  7130.  if (ip->port==0) sprintf(tsocmd,"%s %s",TELNET_COMMAND_NAME,ip->host);         
  7131.  else sprintf(tsocmd,"%s %s %d",TELNET_COMMAND_NAME,ip->host,ip->port);         
  7132.                                                                                 
  7133.  if ((tsorc = GGMtso(tsocmd)) != 0) {                                           
  7134.    ERR3("%s command returned code %d", TELNET_COMMAND_NAME, tsorc);             
  7135.  }                                                                              
  7136.                                                                                 
  7137.  GGMispf(gp,"CONTROL DISPLAY REFRESH");                                         
  7138.                                                                                 
  7139.  return TRUE;                                                                   
  7140. }                                                                               
  7141.                                                                                 
  7142. ./   ADD NAME=GGMTSO,SSI=01000051                                               
  7143.                                                                                 
  7144.  /********************************************************************/         
  7145.  /*                                                                  */         
  7146.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7147.  /*                                                                  */         
  7148.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7149.  /*                                                                  */         
  7150.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7151.  /* including the implied warranties of merchantability and fitness, */         
  7152.  /* are expressly denied.                                            */         
  7153.  /*                                                                  */         
  7154.  /* Provided this copyright notice is included, this software may    */         
  7155.  /* be freely distributed and not offered for sale.                  */         
  7156.  /*                                                                  */         
  7157.  /* Changes or modifications may be made and used only by the maker  */         
  7158.  /* of same, and not further distributed.  Such modifications should */         
  7159.  /* be mailed to the author for consideration for addition to the    */         
  7160.  /* software and incorporation in subsequent releases.               */         
  7161.  /*                                                                  */         
  7162.  /********************************************************************/         
  7163.                                                                                 
  7164.  /********************************************************************/         
  7165.  /*                                                                  */         
  7166.  /* Thanks to Michael Van Norman for this code.                      */         
  7167.  /*                                                                  */         
  7168.  /********************************************************************/         
  7169.                                                                                 
  7170. #pragma  csect(code,  "GG@TSO  ")                                               
  7171. #pragma  csect(static,"GG$TSO  ")                                               
  7172. #include "gg.h"                                                                 
  7173.                                                                                 
  7174. #pragma linkage(ikjeftsr,OS)                                                    
  7175.                                                                                 
  7176. #define _IKJEFTSR_FLAGS_AUTH        0x00000000                                  
  7177. #define _IKJEFTSR_FLAGS_COMMAND     0x00000001                                  
  7178. #define _IKJEFTSR_FLAGS_DUMP        0x00000100                                  
  7179. #define _IKJEFTSR_FLAGS_NODUMP      0x00000000                                  
  7180. #define _IKJEFTSR_FLAGS_PROGRAM     0x00000002                                  
  7181. #define _IKJEFTSR_FLAGS_UNAUTH      0x00010000                                  
  7182.                                                                                 
  7183. /****** Issue TSO command. *******************************************/         
  7184.                                                                                 
  7185. int                                                                             
  7186. GGMtso(command)                                                                 
  7187. char        *command;                                                           
  7188. {                                                                               
  7189.  int         flags         = _IKJEFTSR_FLAGS_COMMAND +                          
  7190.                              _IKJEFTSR_FLAGS_UNAUTH;                            
  7191.  int         commandLength = strlen(command);                                   
  7192.  int         rc            = 0;                                                 
  7193.  int         returnCode    = 0;                                                 
  7194.  int         reasonCode    = 0;                                                 
  7195.  int         abendCode     = 0;                                                 
  7196.                                                                                 
  7197.  static int (*ikjeftsr)() = NULL;                                               
  7198.                                                                                 
  7199.  if (!ikjeftsr) {                                                               
  7200.    int tsoEntryAddress;                                                         
  7201.                                                                                 
  7202.    tsoEntryAddress = 0x00000010;    /* Address of CVT */                        
  7203.    tsoEntryAddress = *(int *)(tsoEntryAddress);                                 
  7204.    tsoEntryAddress += 0x9C;/*       /* Offset of TVT in CVT */                  
  7205.    tsoEntryAddress = *(int *)(tsoEntryAddress);                                 
  7206.    tsoEntryAddress += 0x10;/*       /* TSVTASF-TSVT (from IKJTSVT) */           
  7207.    tsoEntryAddress = *(int *)(tsoEntryAddress);                                 
  7208.    ikjeftsr = (int (*)())(tsoEntryAddress);                                     
  7209.  }                                                                              
  7210.                                                                                 
  7211.  if (!ikjeftsr) {                                                               
  7212.    fprintf(stderr,                                                              
  7213.            "Cannot execute TSO commands, can't fetch IKJEFTSR.\n");             
  7214.    return -2;                                                                   
  7215.  }                                                                              
  7216.                                                                                 
  7217.  rc = (*ikjeftsr)(&flags, command, &commandLength,                              
  7218.                           &returnCode, &reasonCode,                             
  7219.                           (int *)((int)(&abendCode) | 0x80000000));             
  7220.                                                                                 
  7221.  if (rc != 0) {                                                                 
  7222.    if (rc > 4) {                                                                
  7223.      fprintf(stderr,"Command failed:%s\n",command);                             
  7224.      if (rc == 20 && reasonCode == 40)                                          
  7225.           fprintf(stderr,"Command was not found.\n");                           
  7226.      else fprintf(stderr,                                                       
  7227.              "rc=%d,returncode=%d,reasoncode=%d,abendcode=%8.8x\n",             
  7228.              rc, returnCode, reasonCode, abendCode);                            
  7229.    }                                                                            
  7230.    if (abendCode != 0) rc = -1;                                                 
  7231.    else rc = returnCode;                                                        
  7232.  }                                                                              
  7233.                                                                                 
  7234.  return rc;                                                                     
  7235. }                                                                               
  7236.                                                                                 
  7237. ./   ADD NAME=GGMTYPE,SSI=01040025                                              
  7238.                                                                                 
  7239.  /********************************************************************/         
  7240.  /*                                                                  */         
  7241.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7242.  /*                                                                  */         
  7243.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7244.  /*                                                                  */         
  7245.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7246.  /* including the implied warranties of merchantability and fitness, */         
  7247.  /* are expressly denied.                                            */         
  7248.  /*                                                                  */         
  7249.  /* Provided this copyright notice is included, this software may    */         
  7250.  /* be freely distributed and not offered for sale.                  */         
  7251.  /*                                                                  */         
  7252.  /* Changes or modifications may be made and used only by the maker  */         
  7253.  /* of same, and not further distributed.  Such modifications should */         
  7254.  /* be mailed to the author for consideration for addition to the    */         
  7255.  /* software and incorporation in subsequent releases.               */         
  7256.  /*                                                                  */         
  7257.  /********************************************************************/         
  7258.                                                                                 
  7259. #pragma  csect(code,  "GG@TYPE ")                                               
  7260. #pragma  csect(static,"GG$TYPE ")                                               
  7261. #include "gg.h"                                                                 
  7262.                                                                                 
  7263. /*********************************************************************/         
  7264.                                                                                 
  7265. char *                                                                          
  7266. GGMtype(gophertype t)                                                           
  7267. {                                                                               
  7268.                                                                                 
  7269.  switch (t) {                                                                   
  7270.    case GOPHER_FILE:        return "File     ";                                 
  7271.    case GOPHER_DIRECTORY:   return "Directory";                                 
  7272.    case GOPHER_CSO:         return "Cso      ";                                 
  7273.    case GOPHER_ERROR:       return "Error    ";                                 
  7274.    case GOPHER_MAC_BINHEX:  return "Binhex   ";                                 
  7275.    case GOPHER_DOS_BINARCH: return "Binarch  ";                                 
  7276.    case GOPHER_UUENCODE:    return "Uuencode ";                                 
  7277.    case GOPHER_WAIS:        return "Index    ";                                 
  7278.    case GOPHER_TELNET:      return "Telnet   ";                                 
  7279.    case GOPHER_TN3270:      return "TN3270   ";                                 
  7280.    case GOPHER_BINARY:      return "Binary   ";                                 
  7281.    case GOPHER_REDUNDANT:   return "Redundant";                                 
  7282.    case GOPHER_WHOIS:       return "Whois    ";                                 
  7283.    default:                 return "Unknown  ";                                 
  7284.  }                                                                              
  7285. }                                                                               
  7286.                                                                                 
  7287. ./   ADD NAME=GGMUNALC,SSI=01000040                                             
  7288.                                                                                 
  7289.  /********************************************************************/         
  7290.  /*                                                                  */         
  7291.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7292.  /*                                                                  */         
  7293.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7294.  /*                                                                  */         
  7295.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7296.  /* including the implied warranties of merchantability and fitness, */         
  7297.  /* are expressly denied.                                            */         
  7298.  /*                                                                  */         
  7299.  /* Provided this copyright notice is included, this software may    */         
  7300.  /* be freely distributed and not offered for sale.                  */         
  7301.  /*                                                                  */         
  7302.  /* Changes or modifications may be made and used only by the maker  */         
  7303.  /* of same, and not further distributed.  Such modifications should */         
  7304.  /* be mailed to the author for consideration for addition to the    */         
  7305.  /* software and incorporation in subsequent releases.               */         
  7306.  /*                                                                  */         
  7307.  /********************************************************************/         
  7308.                                                                                 
  7309. #pragma  csect(code,  "GG@UNALC")                                               
  7310. #pragma  csect(static,"GG$UNALC")                                               
  7311. #include "gg.h"                                                                 
  7312.                                                                                 
  7313. /****** Unallocate a data set. ***************************************/         
  7314.                                                                                 
  7315. Bool                                                                            
  7316. GGMunalc(ddname)                                                                
  7317. char         *ddname;                                                           
  7318. {                                                                               
  7319.  __S99parms   stuff99;   /* The manual has it wrong.  No "struct". */           
  7320.  int          rc;                                                               
  7321.  char        *cp;                                                               
  7322.  TEXTUNIT    *tu [2];                                                           
  7323.  TEXTUNIT     tu_ddn;                                                           
  7324.  TEXTUNIT     tu_una;                                                           
  7325.                                                                                 
  7326.  if (!ddname ||                                                                 
  7327.      !*ddname) return TRUE;   /* if no ddname to free, do nothing */            
  7328.                                                                                 
  7329.  memset((char *)&stuff99,0,sizeof(__S99parms));                                 
  7330.                                                                                 
  7331.  stuff99.__S99RBLN   = 20;                                                      
  7332.  stuff99.__S99VERB   = S99VRBUN;                                                
  7333.  stuff99.__S99FLAG1  = 0;                                                       
  7334.  stuff99.__S99ERROR  = 0;                                                       
  7335.  stuff99.__S99INFO   = 0;                                                       
  7336.  stuff99.__S99TXTPP  = tu;                                                      
  7337.  stuff99.__S99FLAG2  = 0;                                                       
  7338.                                                                                 
  7339.  tu[0] = &tu_ddn;                                                               
  7340.  tu[1] = &tu_una;                                                               
  7341.  *(int *)&tu[1] |= 0x80000000;                                                  
  7342.                                                                                 
  7343.  tu_ddn.key     = DUNDDNAM;                                                     
  7344.  tu_ddn.num     = 1;                                                            
  7345.  tu_ddn.ent.len = strlen(ddname);                                               
  7346.  strcpy(tu_ddn.ent.prm,ddname);                                                 
  7347.                                                                                 
  7348.  tu_una.key     = DUNUNALC;                                                     
  7349.  tu_una.num     = 0;                                                            
  7350.                                                                                 
  7351.  for (cp=tu_ddn.ent.prm; *cp; cp++) *cp = toupper(*cp);                         
  7352.                                                                                 
  7353.  rc = svc99(&stuff99);                                                          
  7354.                                                                                 
  7355.  if (rc == 0) return TRUE;                                                      
  7356.  else if (stuff99.__S99ERROR == 0x0438) /* not freed, is not allocated*/        
  7357.          return TRUE;                                                           
  7358.  else {                                                                         
  7359.    GGMdfail(rc,&stuff99);                                                       
  7360.    return FALSE;                                                                
  7361.  }                                                                              
  7362. }                                                                               
  7363.                                                                                 
  7364. ./   ADD NAME=GGMVTX,SSI=01050014                                               
  7365.                                                                                 
  7366.  /********************************************************************/         
  7367.  /*                                                                  */         
  7368.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7369.  /*                                                                  */         
  7370.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7371.  /*                                                                  */         
  7372.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7373.  /* including the implied warranties of merchantability and fitness, */         
  7374.  /* are expressly denied.                                            */         
  7375.  /*                                                                  */         
  7376.  /* Provided this copyright notice is included, this software may    */         
  7377.  /* be freely distributed and not offered for sale.                  */         
  7378.  /*                                                                  */         
  7379.  /* Changes or modifications may be made and used only by the maker  */         
  7380.  /* of same, and not further distributed.  Such modifications should */         
  7381.  /* be mailed to the author for consideration for addition to the    */         
  7382.  /* software and incorporation in subsequent releases.               */         
  7383.  /*                                                                  */         
  7384.  /********************************************************************/         
  7385.                                                                                 
  7386. #pragma  csect(code,  "GG@VTX  ")                                               
  7387. #pragma  csect(static,"GG$VTX  ")                                               
  7388. #include "gg.h"                                                                 
  7389.                                                                                 
  7390. /****** BRIF fakeout. ************************************************/         
  7391.                                                                                 
  7392. static void                                                                     
  7393. fake_out_for_brif(fpp,codebuf)                                                  
  7394. void **fpp;                                                                     
  7395. char  *codebuf;                                                                 
  7396.                                                                                 
  7397. #ifndef I370                                                                    
  7398.                                                                                 
  7399. /* The purpose of this is to put a wrapper around the actual                    
  7400.    function pointed to by the argument, so that FORTRAN-style                   
  7401.    return codes (in register 0) get put into register 15.                       
  7402.                                                                                 
  7403.    Source code:                                                                 
  7404.                                                                                 
  7405.          USING *,15                                                             
  7406.          ST    14,save_14                                                       
  7407.          L     15,realcode                                                      
  7408.          DROP  15                                                               
  7409.          BALR  14,15                                                            
  7410.          USING *,14                                                             
  7411.          L     14,save_14                                                       
  7412.          DROP  14                                                               
  7413.          LR    15,0                                                             
  7414.          BR    14                                                               
  7415.          SPACE 1                                                                
  7416. save_14  DS    F                                                                
  7417. realcode DS    F                                                                
  7418.                                                                                 
  7419.  *** Warning: As written, this fake-out code is not reentrant. ***              
  7420.                                                                                 
  7421. */                                                                              
  7422.                                                                                 
  7423. {                                                                               
  7424.  static char fake_out_code[32] = {                                              
  7425.                                0x50,0xE0,0xF0,0x14,0x58,0xF0,0xF0,0x18,         
  7426.                                0x05,0xEF,0x58,0xE0,0xE0,0x0A,0x18,0xF0,         
  7427.                                0x07,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,         
  7428.                                0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00          
  7429.                                  };                                             
  7430.                                                                                 
  7431.  memcpy(codebuf,fake_out_code,32);                                              
  7432.  memcpy(codebuf+0x18,(char *)fpp,4);                                            
  7433.                                                                                 
  7434. #else                                                                           
  7435.                                                                                 
  7436. /* The purpose of this is to put a wrapper around the actual                    
  7437.    function pointed to by the argument, so that the C Runtime                   
  7438.    Anchor Block pointer (in register 12) can be saved/restored.                 
  7439. */                                                                              
  7440.                                                                                 
  7441. {                                                                               
  7442. #define FAKE_BUF_SIZE 48               /*                             */        
  7443.  static short fake_out_code[FAKE_BUF_SIZE/2] =                                  
  7444.  {                                     /*     USING *,15              */        
  7445.   0x50C0,0xF020,                       /* +00 ST    14,save_12        */        
  7446.   0x50E0,0xF024,                       /* +04 ST    12,save_14        */        
  7447.   0x58C0,0xF02C,                       /* +08 L     12,crab           */        
  7448.   0x58F0,0xF028,                       /* +0C L     15,realcode       */        
  7449.                                        /*     DROP  15                */        
  7450.   0x58F0,0xF000,                       /* +10 L     15,0(,15)         */        
  7451.   0x05EF,                              /* +14 BALR  14,15             */        
  7452.                                        /*     USING *,14              */        
  7453.   0x58C0,0xE00A,                       /* +16 L     12,save_12        */        
  7454.   0x58E0,0xE00E,                       /* +1A L     14,save_14        */        
  7455.                                        /*     DROP  14                */        
  7456.   0x07FE,                              /* +1E BR    14                */        
  7457.   0x0000,0x0000,                       /* +20 save_12                 */        
  7458.   0x0000,0x0000,                       /* +24 save_14                 */        
  7459.   0x0000,0x0000,                       /* +28 realcode                */        
  7460.   0x0000,0x0000                        /* +2C crab                    */        
  7461.  };                                                                             
  7462.                                                                                 
  7463.  memcpy( codebuf, fake_out_code, FAKE_BUF_SIZE );                               
  7464.  memcpy( codebuf+0x28, (char *)fpp, 4 );                                        
  7465.  _ldregs( R2, codebuf+0x2C  ),         /* get -> crab in fakeout buff */        
  7466.  _code  ( 0, 0x50C0, 0x2000 );         /* save -> CRAB                */        
  7467.                                                                                 
  7468. #endif                                                                          
  7469.                                                                                 
  7470.  *fpp = (void *)codebuf;                                                        
  7471.                                                                                 
  7472.  return;                                                                        
  7473.                                                                                 
  7474. }                                                                               
  7475.                                                                                 
  7476. /****** Print text lines. ********************************************/         
  7477.                                                                                 
  7478. static void                                                                     
  7479. print_text_lines(fp,textp)                                                      
  7480. FILE              *fp;                                                          
  7481. struct textline   *textp;                                                       
  7482. {                                                                               
  7483.  struct textline  *tp;                                                          
  7484.  char             *p;                                                           
  7485.                                                                                 
  7486.  for (tp=textp; tp; tp=tp->next) {                                              
  7487.    if (tp->text_length >= 0) {                                                  
  7488.      p = tp->tab_expanded_text;                                                 
  7489.      while (*p) {                                                               
  7490.        if isprint(*p) fprintf(fp,"%c",*p);                                      
  7491.        else fprintf(fp,"?");                                                    
  7492.        p++;                                                                     
  7493.      }                                                                          
  7494.      fprintf(fp,"\n");                                                          
  7495.    }                                                                            
  7496.  }                                                                              
  7497.  fprintf(fp,"\n");                                                              
  7498.                                                                                 
  7499.  return;                                                                        
  7500. }                                                                               
  7501.                                                                                 
  7502. /****** View the lines of text retrieved from the server. ************/         
  7503.                                                                                 
  7504. Bool                                                                            
  7505. GGMvtx(gp,ip,as_file)                                                           
  7506. Rstruc ggcb         *gp;                                                        
  7507. Rstruc gopherinfo   *ip;                                                        
  7508. Fool                 as_file;  /* ignored */                                    
  7509. {                                                                               
  7510.  int                brif_max_reclen;                                            
  7511.  int                i;                                                          
  7512.  char              *p;                                                          
  7513.  char              *q;                                                          
  7514.  struct texthdr    *texthdrp;                                                   
  7515.  void              *dialog_data_ptr;                                            
  7516.  void              *read_function_ptr;                                          
  7517.  void              *command_function_ptr;                                       
  7518.  char               read_fakeout_buffer    [32];                                
  7519.  char               command_fakeout_buffer [32];                                
  7520.  char               brif_title             [81];                                
  7521.                                                                                 
  7522.  texthdrp = (ip ? &ip->thdr : &gp->thdr);                                       
  7523.                                                                                 
  7524.  if (gp->brifp) {                                                               
  7525.    printf("Cannot use ISPF BROWSE now, displaying in line mode:\n\n");          
  7526.    print_text_lines(stdout,texthdrp->first_text_line);                          
  7527.    return TRUE;                                                                 
  7528.  }                                                                              
  7529.                                                                                 
  7530.  gp->brifp = texthdrp;                                                          
  7531.                                                                                 
  7532.  gp->brif_previous_recno = -1;                                                  
  7533.                                                                                 
  7534.  if (!ip) sprintf(brif_title, "GopherServer:%s ",gp->ggserver);                 
  7535.  else {                                                                         
  7536.    /* BRIF doesn't like blanks in the title */                                  
  7537.    for (p=ip->desc,q=brif_title,i=sizeof(brif_title)-1;                         
  7538.         i > 0 && *p;                                                            
  7539.         p++,q++,i--) {                                                          
  7540.      *q = (*p == ' ' ? '_' : *p);                                               
  7541.    }                                                                            
  7542.    *q = ' ';                                                                    
  7543.    *(q+1) = '\0';                                                               
  7544.  }                                                                              
  7545.                                                                                 
  7546.  brif_max_reclen      = gp->brifp->text_max_tab_expanded_length;                
  7547.  dialog_data_ptr      = (void *)gp;                                             
  7548.  read_function_ptr    = (void *)&GGMbrifr;                                      
  7549.  command_function_ptr = (void *)&GGMbrifc;                                      
  7550.                                                                                 
  7551.  fake_out_for_brif(&read_function_ptr,read_fakeout_buffer);                     
  7552.  fake_out_for_brif(&command_function_ptr,command_fakeout_buffer);               
  7553.                                                                                 
  7554.  if (gp->test_mode) {                                                           
  7555.    printf("Here are the %d lines BRIF should be displaying:\n\n",               
  7556.           gp->brifp->text_line_count);                                          
  7557.    print_text_lines(stdout,gp->brifp->first_text_line);                         
  7558.    gp->brifp = NULL;                                                            
  7559.    return TRUE;                                                                 
  7560.  }                                                                              
  7561.                                                                                 
  7562.  if (gp->setmsg) {                                                              
  7563.    (void)GGMispf(gp,"SETMSG MSG(ISRZ002)");                                     
  7564.    gp->setmsg = FALSE;                                                          
  7565.  }                                                                              
  7566.                                                                                 
  7567.  gp->ispfrc = ISPLINK("BRIF ",                                                  
  7568.                       brif_title,                                               
  7569.                       "V ",              /* variable record format */           
  7570.                       &brif_max_reclen,                                         
  7571.                       &read_function_ptr,                                       
  7572.                       &command_function_ptr,                                    
  7573.                       &dialog_data_ptr,                                         
  7574.                       "        ",        /* use IBM's   browse panel */         
  7575.                       "        ",        /* no format */                        
  7576.                       "NO ");            /* default sbcs data */                
  7577.                                                                                 
  7578.  gp->brifp = NULL;                                                              
  7579.                                                                                 
  7580.  switch (gp->ispfrc) {                                                          
  7581.    case  0:                                                                     
  7582.            break;                                                               
  7583.    case 12:                                                                     
  7584.  ERR1("There is no data returned from the gopher host to be browsed.");         
  7585.            break;                                                               
  7586.    case 16:                                                                     
  7587.            break;                                                               
  7588.    default:                                                                     
  7589.            GGMierr(gp);   /* handle ISPF error */                               
  7590.            break;                                                               
  7591.  }                                                                              
  7592.                                                                                 
  7593.  return TRUE;                                                                   
  7594. }                                                                               
  7595.                                                                                 
  7596. ./   ADD NAME=GGMWAIS,SSI=01080054                                              
  7597.                                                                                 
  7598.  /********************************************************************/         
  7599.  /*                                                                  */         
  7600.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7601.  /*                                                                  */         
  7602.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7603.  /*                                                                  */         
  7604.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7605.  /* including the implied warranties of merchantability and fitness, */         
  7606.  /* are expressly denied.                                            */         
  7607.  /*                                                                  */         
  7608.  /* Provided this copyright notice is included, this software may    */         
  7609.  /* be freely distributed and not offered for sale.                  */         
  7610.  /*                                                                  */         
  7611.  /* Changes or modifications may be made and used only by the maker  */         
  7612.  /* of same, and not further distributed.  Such modifications should */         
  7613.  /* be mailed to the author for consideration for addition to the    */         
  7614.  /* software and incorporation in subsequent releases.               */         
  7615.  /*                                                                  */         
  7616.  /********************************************************************/         
  7617.                                                                                 
  7618. #pragma  csect(code,  "GG@WAIS ")                                               
  7619. #pragma  csect(static,"GG$WAIS ")                                               
  7620. #include "gg.h"                                                                 
  7621.                                                                                 
  7622. /****** Gopher WAIS interface. *************************************/           
  7623.                                                                                 
  7624. Bool                                                                            
  7625. GGMwais(gp,ip,as_file)                                                          
  7626. Rstruc ggcb        *gp;                                                         
  7627. Rstruc gopherinfo  *ip;                                                         
  7628. Fool                as_file;                                                    
  7629. {                                                                               
  7630.  char              *lp;                                                         
  7631.  char               ggwaisq[256];                                               
  7632.                                                                                 
  7633.  strcpy(gp->ggserver,ip->host);     /* Specify server to connect to */          
  7634.                                                                                 
  7635.  strcpy(ggwaisq,"");                                                            
  7636.                                                                                 
  7637.  GGMispf(gp,"VGET (GGWAISQ) PROFILE");                                          
  7638.                                                                                 
  7639.  if (GGMdispl(gp,"GGMPWAIS") > 0) return FALSE;                                 
  7640.                                                                                 
  7641.  GGMivget(gp,"GGWAISQ ",ggwaisq, sizeof(ggwaisq));                              
  7642.                                                                                 
  7643.  if (!*ip->path) strcpy(gp->gopher_command, ggwaisq);                           
  7644.  else            sprintf(gp->gopher_command,"%s\t%s",ip->path,ggwaisq);         
  7645.                                                                                 
  7646.  gp->ginfo = ip;                                                                
  7647.  gp->receiving_text = FALSE;                                                    
  7648.                                                                                 
  7649.  if (!GGMconn(gp)) return FALSE;   /* Connect to gopher server      */          
  7650.                                                                                 
  7651.  if (!GGMsockt(gp)) return FALSE;  /* Send socket command to server */          
  7652.                                                                                 
  7653.  GGMclrtx(gp,ip);                  /* Clear text */                             
  7654.                                                                                 
  7655.  gp->receiving_text = TRUE;                                                     
  7656.                                                                                 
  7657.  do {                                                                           
  7658.    if (GGMgsrvl(gp,&lp,TRUE)) {           /* Get server line */                 
  7659.      if (lp) {                                                                  
  7660.        (void)GGMouttx(gp,lp,ip);          /* Output text line */                
  7661.      }                                                                          
  7662.    }                                                                            
  7663.  } while (lp);                            /* until no more lines */             
  7664.                                                                                 
  7665.  if (gp->time_to_go_home) {                                                     
  7666.    WARN2("No data available from server %s.\n",gp->ggserver);                   
  7667.    return FALSE;                                                                
  7668.  }                                                                              
  7669.                                                                                 
  7670.  if (gp->connected_to_server) {                                                 
  7671.    (void)GGMdisc(gp);              /* Disconnect from gopher server */          
  7672.  }                                                                              
  7673.                                                                                 
  7674.  GGMdir(gp,ip,as_file); /* display entries returned from WAIS server */         
  7675.                                                                                 
  7676.  return TRUE;                                                                   
  7677.                                                                                 
  7678. }                                                                               
  7679.                                                                                 
  7680. ./   ADD NAME=GGMWHOIS,SSI=01030030                                             
  7681.                                                                                 
  7682.  /********************************************************************/         
  7683.  /*                                                                  */         
  7684.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7685.  /*                                                                  */         
  7686.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7687.  /*                                                                  */         
  7688.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7689.  /* including the implied warranties of merchantability and fitness, */         
  7690.  /* are expressly denied.                                            */         
  7691.  /*                                                                  */         
  7692.  /* Provided this copyright notice is included, this software may    */         
  7693.  /* be freely distributed and not offered for sale.                  */         
  7694.  /*                                                                  */         
  7695.  /* Changes or modifications may be made and used only by the maker  */         
  7696.  /* of same, and not further distributed.  Such modifications should */         
  7697.  /* be mailed to the author for consideration for addition to the    */         
  7698.  /* software and incorporation in subsequent releases.               */         
  7699.  /*                                                                  */         
  7700.  /********************************************************************/         
  7701.                                                                                 
  7702. #pragma  csect(code,  "GG@WHOIS")                                               
  7703. #pragma  csect(static,"GG$WHOIS")                                               
  7704. #include "gg.h"                                                                 
  7705.                                                                                 
  7706. /****** Gopher WHOIS/FINGER interface. *****************************/           
  7707.                                                                                 
  7708. Bool                                                                            
  7709. GGMwhois(gp,ip,as_file)                                                         
  7710. Rstruc ggcb        *gp;                                                         
  7711. Rstruc gopherinfo  *ip;                                                         
  7712. Fool                as_file;        /* ignored */                               
  7713. {                                                                               
  7714.  char              *lp;                                                         
  7715.  Bool               got_some;                                                   
  7716.  char               ggwhoisq[256];                                              
  7717.                                                                                 
  7718.  strcpy(gp->ggserver,ip->host);     /* Specify server to connect to */          
  7719.                                                                                 
  7720.  strcpy(ggwhoisq,"");                                                           
  7721.                                                                                 
  7722.  GGMispf(gp,"VGET (GGWHOISQ) PROFILE");                                         
  7723.                                                                                 
  7724.  if (GGMdispl(gp,"GGMPWHOI") > 0) return FALSE;                                 
  7725.                                                                                 
  7726.  GGMivget(gp,"GGWHOISQ ",ggwhoisq, sizeof(ggwhoisq));                           
  7727.                                                                                 
  7728.  if (!*ip->path) strcpy(gp->gopher_command, ggwhoisq);                          
  7729.  else            sprintf(gp->gopher_command,"%s\t%s",ip->path,ggwhoisq);        
  7730.                                                                                 
  7731.  gp->ginfo = ip;                                                                
  7732.  gp->receiving_text = FALSE;                                                    
  7733.                                                                                 
  7734.  if (!GGMconn(gp)) return FALSE;   /* Connect to gopher server      */          
  7735.                                                                                 
  7736.  if (!GGMsockt(gp)) return FALSE;  /* Send socket command to server */          
  7737.                                                                                 
  7738.  GGMclrtx(gp,ip);                  /* Clear text */                             
  7739.                                                                                 
  7740.  gp->receiving_text = TRUE;                                                     
  7741.  got_some = FALSE;                                                              
  7742.  do {                                                                           
  7743.    if (GGMgsrvl(gp,&lp,TRUE)) {           /* Get server line */                 
  7744.      if (lp) {                                                                  
  7745.        got_some = TRUE;                                                         
  7746.        (void)GGMouttx(gp,lp,ip);          /* Output text line */                
  7747.      }                                                                          
  7748.    }                                                                            
  7749.  } while (lp);                            /* until no more lines */             
  7750.                                                                                 
  7751.  if (!got_some) {                                                               
  7752.    WARN2("No data available from server %s.\n",gp->ggserver);                   
  7753.    return FALSE;                                                                
  7754.  }                                                                              
  7755.                                                                                 
  7756.  if (gp->connected_to_server) {                                                 
  7757.    (void)GGMdisc(gp);              /* Disconnect from gopher server */          
  7758.  }                                                                              
  7759.                                                                                 
  7760.  GGMvtx(gp,ip,as_file);  /* display text from WHOIS/FINGER server */            
  7761.                                                                                 
  7762.  return TRUE;                                                                   
  7763.                                                                                 
  7764. }                                                                               
  7765.                                                                                 
  7766. ./   ADD NAME=GGMXTX,SSI=01050051                                               
  7767.                                                                                 
  7768.  /********************************************************************/         
  7769.  /*                                                                  */         
  7770.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  7771.  /*                                                                  */         
  7772.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  7773.  /*                                                                  */         
  7774.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  7775.  /* including the implied warranties of merchantability and fitness, */         
  7776.  /* are expressly denied.                                            */         
  7777.  /*                                                                  */         
  7778.  /* Provided this copyright notice is included, this software may    */         
  7779.  /* be freely distributed and not offered for sale.                  */         
  7780.  /*                                                                  */         
  7781.  /* Changes or modifications may be made and used only by the maker  */         
  7782.  /* of same, and not further distributed.  Such modifications should */         
  7783.  /* be mailed to the author for consideration for addition to the    */         
  7784.  /* software and incorporation in subsequent releases.               */         
  7785.  /*                                                                  */         
  7786.  /********************************************************************/         
  7787.                                                                                 
  7788. #pragma  csect(code,  "GG@XTX  ")                                               
  7789. #pragma  csect(static,"GG$XTX  ")                                               
  7790. #include "gg.h"                                                                 
  7791.                                                                                 
  7792. /****** Extract the lines of server text into a data set. ************/         
  7793.                                                                                 
  7794. Bool                                                                            
  7795. GGMxtx(gp,ip)                                                                   
  7796. Rstruc ggcb         *gp;                                                        
  7797. Rstruc gopherinfo   *ip;                                                        
  7798. {                                                                               
  7799.  FILE               *xfp;                                                       
  7800.  struct texthdr     *thp;                                                       
  7801.  struct textline    *tp;                                                        
  7802.  struct extraction  *ep;                                                        
  7803.  int                 l;                                                         
  7804.  char               *cp;                                                        
  7805.  char                formatted_number [11];                                     
  7806.  struct extraction   the_extraction;                                            
  7807.                                                                                 
  7808.  thp = (ip ? &ip->thdr : &gp->thdr);                                            
  7809.                                                                                 
  7810.  /* Set article data for message. */                                            
  7811.                                                                                 
  7812.  if (ip) {                                                                      
  7813.    sprintf(formatted_number,"%d",ip->type);                                     
  7814.    (void)GGMivput(gp,"GGTNUM ",  formatted_number, -1);                         
  7815.    (void)GGMivput(gp,"GGTSUBJ ", ip->desc,         -1);                         
  7816.  }                                                                              
  7817.                                                                                 
  7818.  if (gp->extract_file) {                                                        
  7819.    (void)GGMispf(gp,"CONTROL DISPLAY LOCK");                                    
  7820.    (void)GGMispf(gp,"DISPLAY PANEL(GGMLEXN2)");                                 
  7821.    xfp = gp->extract_file;                                                      
  7822.  }                                                                              
  7823.  else {                                                                         
  7824.                                                                                 
  7825.    ep = &the_extraction;                                                        
  7826.    memset(ep,0,sizeof(struct extraction));                                      
  7827.    ep->mode = SEQ;                                                              
  7828.    strcpy(ep->panelname,"GGMPEXDS");                                            
  7829.                                                                                 
  7830.    if (!((xfp=GGMgetds(gp,ep)))) return FALSE;                                  
  7831.                                                                                 
  7832.    gp->extract_tab_expanding          = ep->tab_expanding;                      
  7833.    gp->extract_appending              = ep->appending;                          
  7834.    gp->extract_blank_before_separator = ep->blanking;                           
  7835.    gp->extract_separator_line         = ep->separator;                          
  7836.  }                                                                              
  7837.                                                                                 
  7838.  /* If append mode, and a separator line was specified, use it. */              
  7839.                                                                                 
  7840.  gp->extract_write_error = FALSE;                                               
  7841.  gp->extract_close_error = FALSE;                                               
  7842.                                                                                 
  7843.  while (gp->extract_appending && gp->extract_separator_line &&                  
  7844.         *gp->extract_separator_line) {                                          
  7845.    if (fprintf(xfp,"%s\n",gp->extract_separator_line) < 0) {                    
  7846.      gp->extract_write_error = TRUE; break;                                     
  7847.    }                                                                            
  7848.    if (gp->extract_blank_before_separator) {                                    
  7849.      if (fprintf(xfp,"\n") < 0) {                                               
  7850.        gp->extract_write_error = TRUE; break;                                   
  7851.      }                                                                          
  7852.    }                                                                            
  7853.    break;                                                                       
  7854.  }                                                                              
  7855.  for (tp = thp->first_text_line;                                                
  7856.       tp && !gp->extract_write_error;                                           
  7857.       tp = tp->next) {                                                          
  7858.    if (tp->text_length == 0) {                                                  
  7859.      if (fputc('\n',xfp) == EOF) {                                              
  7860.        gp->extract_write_error = TRUE; break;                                   
  7861.      }                                                                          
  7862.    }                                                                            
  7863.    else if (tp->text_length > 0) {                                              
  7864.      if (gp->extract_tab_expanding) {                                           
  7865.        cp = tp->tab_expanded_text;                                              
  7866.        l  = tp->tab_expanded_text_length;                                       
  7867.      }                                                                          
  7868.      else {                                                                     
  7869.        cp = tp->text;                                                           
  7870.        l  = tp->text_length;                                                    
  7871.      }                                                                          
  7872.      for (; l > 0; cp += 251, l -= 251) {                                       
  7873.        fwrite(cp,(l>251 ? 251 : l),1,xfp);                                      
  7874.        if (ferror(xfp)) {                                                       
  7875.          gp->extract_write_error = TRUE; break;                                 
  7876.        }                                                                        
  7877.        if (fputc('\n',xfp) == EOF) {                                            
  7878.          gp->extract_write_error = TRUE; break;                                 
  7879.        }                                                                        
  7880.      }                                                                          
  7881.    }                                                                            
  7882.  }                                                                              
  7883.                                                                                 
  7884.  if (!gp->extract_write_error && ferror(xfp))                                   
  7885.     gp->extract_write_error = TRUE;                                             
  7886.                                                                                 
  7887.  if (!gp->extract_appending || !gp->extract_file) {                             
  7888.    if (fclose(xfp) < 0) {                                                       
  7889.      /* perror(nnexdsn); */                                                     
  7890.      ERR2("An error occurred closing data set %s.", ep->dsname);                
  7891.      gp->extract_close_error = TRUE;                                            
  7892.      return FALSE;                                                              
  7893.    }                                                                            
  7894.  }                                                                              
  7895.                                                                                 
  7896.  if (!gp->extract_file) {                                                       
  7897.    if (gp->extract_write_error) {                                               
  7898.      ERR2("An error occurred writing to data set %s.", ep->dsname);             
  7899.      gp->extract_write_error = TRUE;                                            
  7900.    }                                                                            
  7901.    else if (ip) {                                                               
  7902.      WARN2("Current item extracted into file %s.",                              
  7903.             ep->dsname);                                                        
  7904.    }                                                                            
  7905.    else {                                                                       
  7906.      WARN2("Displayed text has been extracted into file %s.",                   
  7907.             ep->dsname);                                                        
  7908.    }                                                                            
  7909.  }                                                                              
  7910.  if (gp->extract_write_error) return FALSE;                                     
  7911.  else return TRUE;                                                              
  7912. }                                                                               
  7913.                                                                                 
  7914. ./   ADD NAME=GGSERVER,SSI=01240010                                             
  7915. /*                                                                              
  7916.  ***********************************************************************        
  7917.  *                                                                     *        
  7918.  * GOPHER server, based on the simple TCP/IP server from Shawn Hart at *        
  7919.  * the University of Delaware.                                         *        
  7920.  *                                                                     *        
  7921.  ***********************************************************************        
  7922.  *                                                                              
  7923.  *  This server follows the GOPHER protocols defined by UMN.                    
  7924.  *  For more information, see the ANONYMOUS FTP site at                         
  7925.  *  BOOMBOX.MICRO.UMN.EDU.                                                      
  7926.  *                                                                              
  7927.  ***********************************************************************        
  7928.  *                                                                              
  7929.  * November 1992 - parameters may be passed to the server:                      
  7930.  *                                                                              
  7931.  * -d              run in debug mode                                            
  7932.  *                                                                              
  7933.  ***********************************************************************        
  7934.  *                                                                              
  7935.  * December 1992 - support for SNS/TCPAccess compilation                        
  7936.  *                                                                              
  7937.  ***********************************************************************        
  7938.  */                                                                             
  7939.                                                                                 
  7940. #pragma  csect(code,  "GG@ERVER")                                               
  7941. #pragma  csect(static,"GG$ERVER")                                               
  7942. #include "gg.h"                 /* All system file includes needed. */          
  7943.                                                                                 
  7944. /********************************************************************/          
  7945.                                                                                 
  7946. static int                                                                      
  7947. tcpsetup(int          port,                                                     
  7948.          int          qlen,                                                     
  7949.          FILE        *debugfp)                                                  
  7950. {                                                                               
  7951.  int                  tinitrc;             /* loop counter*/                    
  7952.  int                  sockfd;              /* loop counter*/                    
  7953.  int                  x;                   /* loop counter*/                    
  7954.  struct linger        l;                   /* linger for setsockopt */          
  7955.  struct sockaddr_in   server;          /*server address information */          
  7956.                                                                                 
  7957.  /*    initialize the MTF  environment.                   */                    
  7958.                                                                                 
  7959.  if (debugfp) {                                                                 
  7960.    fprintf(debugfp,"tinit...\n");                                               
  7961.    fflush(debugfp);                                                             
  7962.  }                                                                              
  7963.                                                                                 
  7964.  tinitrc = tinit("GGSTASK", MTF_TASKS);                                         
  7965.                                                                                 
  7966.  if (tinitrc != MTF_OK) {                                                       
  7967.    GGMmtfer(tinitrc, "TINIT");                                                  
  7968.    return -1;                                                                   
  7969.  }                                                                              
  7970.                                                                                 
  7971.  /*       open a TCP socket...                            */                    
  7972.                                                                                 
  7973.  if (debugfp) {                                                                 
  7974.    fprintf(debugfp,"socket...\n");                                              
  7975.    fflush(debugfp);                                                             
  7976.  }                                                                              
  7977.                                                                                 
  7978.  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {                          
  7979.    REPORT_TCP_ERROR("SOCKET - ");                                               
  7980.    return -1;                                                                   
  7981.  };                                                                             
  7982.                                                                                 
  7983.  /*  set the linger option on so we wait for data to be sent... */              
  7984.                                                                                 
  7985.  l.l_onoff  =  1;                                                               
  7986.  l.l_linger =100;           /* wait 100 seconds before giving up */             
  7987.                                                                                 
  7988.  if (debugfp) {                                                                 
  7989.    fprintf(debugfp,"setsockopt (%d, SO_LINGER)...\n",sockfd);                   
  7990.    fflush(debugfp);                                                             
  7991.  }                                                                              
  7992.                                                                                 
  7993.  if (setsockopt(sockfd,SOL_SOCKET,SO_LINGER,(char *)&l,sizeof(l))               
  7994.      < 0) {                                                                     
  7995.    REPORT_TCP_ERROR("SETSOCKOPT - ");                                           
  7996.    return -1;                                                                   
  7997.  }                                                                              
  7998.                                                                                 
  7999.  /*    now bind our local address so that the client can send to us */          
  8000.                                                                                 
  8001.  memset((char *)&server, 0, sizeof(server));                                    
  8002.  server.sin_family           =   AF_INET;                                       
  8003.  server.sin_addr.s_addr      =   INADDR_ANY;                                    
  8004.  server.sin_port             =   htons(port);                                   
  8005.                                                                                 
  8006.  if (debugfp) {                                                                 
  8007.    fprintf(debugfp,"bind (%d)...\n",sockfd);                                    
  8008.    fflush(debugfp);                                                             
  8009.  }                                                                              
  8010.                                                                                 
  8011.  if (Bind(sockfd, &server, sizeof(server)) < 0) {                               
  8012.    REPORT_TCP_ERROR("BIND - ");                                                 
  8013.    return -1;                                                                   
  8014.  }                                                                              
  8015.                                                                                 
  8016.  /*    now set length of the connection queue... */                             
  8017.                                                                                 
  8018.  if (debugfp) {                                                                 
  8019.    fprintf(debugfp,"listen (sockfd=%d, qlen=%d)...\n",sockfd,qlen);             
  8020.    fflush(debugfp);                                                             
  8021.  }                                                                              
  8022.                                                                                 
  8023.  if (listen(sockfd,qlen) != 0) {                                                
  8024.    REPORT_TCP_ERROR("LISTEN -");                                                
  8025.    return -1;                                                                   
  8026.  }                                                                              
  8027.                                                                                 
  8028.  return sockfd;                                                                 
  8029.                                                                                 
  8030. }                                                                               
  8031.                                                                                 
  8032.                                                                                 
  8033. /********************************************************************/          
  8034. /*                                                                              
  8035. *   This routine waits for an exception on the socket.  When one                
  8036. *   occurs (by a subtask's "TAKESOCKET"!) we'll close our (the main             
  8037. *   task's) connection to it.                                                   
  8038. *                                                                               
  8039. *               INPUT   s   pointer to socket descripter.                       
  8040. *               OUTPUT  rc  -1 = connection timed out...                        
  8041. *                            0 = an excption occured!                           
  8042. */                                                                              
  8043. /********************************************************************/          
  8044.                                                                                 
  8045. #ifdef SNSTCPIP                                                                 
  8046.                                                                                 
  8047. static int                                                                      
  8048. closesock(int              newsockfd,                                           
  8049.           FILE            *debugfp)                                             
  8050. {                                                                               
  8051.  if (debugfp) {                                                                 
  8052.    fprintf(debugfp,"close (%d)...\n",newsockfd);                                
  8053.    fflush(debugfp);                                                             
  8054.  }                                                                              
  8055.                                                                                 
  8056.  if (close(newsockfd) < 0) REPORT_TCP_ERROR("CLOSE -");                         
  8057.  return 0;                                                                      
  8058. }                                                                               
  8059.                                                                                 
  8060. #else                                                                           
  8061.                                                                                 
  8062. static int                                                                      
  8063. closesock(int              newsockfd,                                           
  8064.           FILE            *debugfp)                                             
  8065. {                                                                               
  8066.  int                       temps;                                               
  8067.  struct sockaddr           clientaddress;                                       
  8068.  int                       addrlen;                                             
  8069.  int                       maxfdpl;                                             
  8070.  struct fd_set             readmask;                                            
  8071.  struct fd_set             writmask;                                            
  8072.  struct fd_set             exepmask;                                            
  8073.  int                       rc;                                                  
  8074.  struct timeval            time;                                                
  8075.                                                                                 
  8076.  temps = newsockfd;                                                             
  8077.  time.tv_sec = CONNECT_TIME_OUT;                                                
  8078.  time.tv_usec = 0;                                                              
  8079.  maxfdpl = temps + 1;                                                           
  8080.                                                                                 
  8081.  FD_ZERO(&readmask);                                                            
  8082.  FD_ZERO(&writmask);                                                            
  8083.  FD_ZERO(&exepmask);                                                            
  8084.  FD_SET(temps, &exepmask);                                                      
  8085.                                                                                 
  8086.  if (debugfp) {                                                                 
  8087.    fprintf(debugfp,"select (maxfdpl=%d)...\n",maxfdpl);                         
  8088.    fflush(debugfp);                                                             
  8089.  }                                                                              
  8090.                                                                                 
  8091.  rc = select(maxfdpl, &readmask, &writmask, &exepmask, &time);                  
  8092.                                                                                 
  8093.  if (rc < 0) {                                                                  
  8094.    REPORT_TCP_ERROR("SELECT - ");                                               
  8095.    return rc;                                                                   
  8096.  }                                                                              
  8097.  else {                                                                         
  8098.    if (rc == 0) fprintf(stdout,"The GIVESOCKET timed out!\n");                  
  8099.                                                                                 
  8100.    if (debugfp) {                                                               
  8101.      fprintf(debugfp,"close (%d)...\n",newsockfd);                              
  8102.      fflush(debugfp);                                                           
  8103.    }                                                                            
  8104.                                                                                 
  8105.    if (close(newsockfd) < 0) REPORT_TCP_ERROR("CLOSE -");                       
  8106.    return rc;                                                                   
  8107.  }                                                                              
  8108. }                                                                               
  8109.                                                                                 
  8110. #endif                                                                          
  8111.                                                                                 
  8112. /********************************************************************/          
  8113. /*                                                                              
  8114. *       This routine starts a subtask, passing control of a socket              
  8115. *       to it.  It then waits for the subtask to take the socket and            
  8116. *       then closes the socket.                                                 
  8117. *                                                                               
  8118. *       INPUT: newsockfd - socket descriptor to give to subtask.                
  8119. */                                                                              
  8120. /********************************************************************/          
  8121.                                                                                 
  8122. static Bool                                                                     
  8123. spawn(                                                                          
  8124.       int          newsockfd,                                                   
  8125.       FILE        *debugfp)                                                     
  8126. {                                                                               
  8127.  int               tschedrc;                                                    
  8128. #ifdef SNSTCPIP                                                                 
  8129.  unsigned long     token;                                                       
  8130. #else                                                                           
  8131.  struct clientid   clid;                                                        
  8132.  char              mysname[8];                                                  
  8133. #endif                                                                          
  8134.                                                                                 
  8135.  if (debugfp) {                                                                 
  8136.    fprintf(debugfp,"getclientid...\n");                                         
  8137.    fflush(debugfp);                                                             
  8138.  }                                                                              
  8139.                                                                                 
  8140. #ifdef SNSTCPIP                                                                 
  8141.                                                                                 
  8142.  token = closepass(newsockfd);                                                  
  8143.  if (debugfp) {                                                                 
  8144.    fprintf(debugfp,"token = %X\n",token);                                       
  8145.    fflush(debugfp);                                                             
  8146.  }                                                                              
  8147.                                                                                 
  8148. #else                                                                           
  8149.                                                                                 
  8150.  memset(&clid,0,sizeof(clid));                                                  
  8151.  if(getclientid(AF_INET,&clid) < 0) {                                           
  8152.    REPORT_TCP_ERROR("GETCLIENTID");                                             
  8153.    return FALSE;                                                                
  8154.  }                                                                              
  8155.                                                                                 
  8156.  if (debugfp) {                                                                 
  8157.    fprintf(debugfp,"client name = %8.8s, subtaskname = %8.8s\n",                
  8158.                    clid.name, clid.subtaskname);                                
  8159.    fflush(debugfp);                                                             
  8160.  }                                                                              
  8161.                                                                                 
  8162.  clid.domain = AF_INET;                                                         
  8163.  memcpy(mysname,clid.subtaskname,8);                                            
  8164.  memcpy(clid.subtaskname,"        ",8);                                         
  8165.                                                                                 
  8166.  if (debugfp) {                                                                 
  8167.    fprintf(debugfp,"givesocket (%d)...\n",newsockfd);                           
  8168.    fflush(debugfp);                                                             
  8169.  }                                                                              
  8170.                                                                                 
  8171.  if(givesocket(newsockfd,&clid) != 0) {                                         
  8172.    REPORT_TCP_ERROR("GIVESOCKET");                                              
  8173.    return FALSE;                                                                
  8174.  }                                                                              
  8175.  memcpy(clid.subtaskname,mysname,8);                                            
  8176.                                                                                 
  8177.  if (debugfp) {                                                                 
  8178.    fprintf(debugfp,"client name = %8.8s, subtaskname = %8.8s\n",                
  8179.                    clid.name, clid.subtaskname);                                
  8180.    fflush(debugfp);                                                             
  8181.  }                                                                              
  8182.                                                                                 
  8183. #endif                                                                          
  8184.                                                                                 
  8185.  if (debugfp) {                                                                 
  8186.    fprintf(debugfp,"tsched...\n");                                              
  8187.    fflush(debugfp);                                                             
  8188.  }                                                                              
  8189.                                                                                 
  8190.  tschedrc = tsched(MTF_ANY,"GGSRECV",                                           
  8191. #ifdef SNSTCPIP                                                                 
  8192.                            token,                                               
  8193. #else                                                                           
  8194.                            newsockfd,                                           
  8195.                            clid,                                                
  8196. #endif                                                                          
  8197.                            (debugfp ? 1 : 0));                                  
  8198.                                                                                 
  8199.  if (debugfp) {                                                                 
  8200.    fprintf(debugfp,"tsched completed...rc=%d\n",tschedrc);                      
  8201.    fflush(debugfp);                                                             
  8202.  }                                                                              
  8203.                                                                                 
  8204.  if (tschedrc != 0) {                                                           
  8205.    GGMmtfer(tschedrc,"TSCHED");                                                 
  8206.    return FALSE;                                                                
  8207.  }                                                                              
  8208.                                                                                 
  8209.  if (closesock(newsockfd,debugfp) < 0) {                                        
  8210.    REPORT_TCP_ERROR("close socket");                                            
  8211.    return FALSE;                                                                
  8212.  }                                                                              
  8213.                                                                                 
  8214.  return TRUE;                                                                   
  8215.                                                                                 
  8216. }                                                                               
  8217.                                                                                 
  8218. /******************************************************************/            
  8219.                                                                                 
  8220. int                                                                             
  8221. main(int            argc,                                                       
  8222.          char     **argv)                                                       
  8223. {                                                                               
  8224.  int                trc;               /* return code */                        
  8225.  int                x;                 /* loop counter*/                        
  8226.  int                sockfd;            /* connection socket...*/                
  8227.  int                newsockfd;         /* new connection socket...*/            
  8228.  int                clientlen;         /* new connection socket...*/            
  8229.  int                i;                                                          
  8230.  char              *p;                                                          
  8231.  FILE              *debugfp;                                                    
  8232.  struct sockaddr_in client;            /* client address information */         
  8233. #ifndef SNSTCPIP                                                                
  8234.  struct clientid    clid;              /* client info for givesocket */         
  8235. #endif                                                                          
  8236.  char               buffer[255];       /* buffer for input/output*/             
  8237.                                                                                 
  8238. /******************************************************************/            
  8239. /* Process server parameters.                                     */            
  8240. /******************************************************************/            
  8241.                                                                                 
  8242.  debugfp = NULL;                                                                
  8243.                                                                                 
  8244.  for (i = 1; i < argc; i++) {                                                   
  8245.    p = argv[i];                                                                 
  8246.    if (*p == '-') {                                                             
  8247.      while (*++p) {                                                             
  8248.        switch (toupper(*p)) {                                                   
  8249.          case 'D':  debugfp = fopen("dd:ggdebug","w");                          
  8250.                     break;                                                      
  8251.          default:   break;                                                      
  8252.        }                                                                        
  8253.      }                                                                          
  8254.    }                                                                            
  8255.  }                                                                              
  8256.                                                                                 
  8257. /******************************************************************/            
  8258. /*         set up the connection to the socket...                 */            
  8259. /******************************************************************/            
  8260.                                                                                 
  8261.  sockfd = tcpsetup(SERV_TCP_PORT,TCP_QUEUE_LENGTH,debugfp);                     
  8262.  if (sockfd < 0) {                                                              
  8263.    fprintf(stdout,"Could not set up the TCP/IP environment!\n");                
  8264.    exit(16);                                                                    
  8265.  }                                                                              
  8266.                                                                                 
  8267. /******************************************************************/            
  8268. /*         Now loop, waiting for a connection request.            */            
  8269. /******************************************************************/            
  8270.                                                                                 
  8271.  clientlen = sizeof(client);                                                    
  8272.  x = 0;                                                                         
  8273.  for (;;) {                                                                     
  8274.                                                                                 
  8275.    if (debugfp) {                                                               
  8276.      fprintf(debugfp,"accept (%d)...\n",sockfd);                                
  8277.      fflush(debugfp);                                                           
  8278.    }                                                                            
  8279.                                                                                 
  8280.    if ((newsockfd=Accept(sockfd,&client,&clientlen)) == -1) {                   
  8281.      REPORT_TCP_ERROR("ACCEPT - ");                                             
  8282.      exit(8);                                                                   
  8283.    }                                                                            
  8284.    if (debugfp) {                                                               
  8285.      fprintf(debugfp,"newsockfd=%d...\n",newsockfd);                            
  8286.      fflush(debugfp);                                                           
  8287.    }                                                                            
  8288.                                                                                 
  8289.    x++;                                                                         
  8290.    if (!spawn(newsockfd,debugfp)) {                                             
  8291.      fprintf(stdout,"spawn failed for socket %d\n",newsockfd);                  
  8292.      exit(8);                                                                   
  8293.    }                                                                            
  8294.    else {                                                                       
  8295.      if (debugfp) {                                                             
  8296.        fprintf(debugfp,"spawn OK for socket %d\n",newsockfd);                   
  8297.        fflush(debugfp);                                                         
  8298.      }                                                                          
  8299.    }                                                                            
  8300.  }                                                                              
  8301.                                                                                 
  8302. /******************************************************************/            
  8303. /*         Wait for all pending tasks to complete (should never   */            
  8304. /*         run, since I haven't added PURGE support yet...)       */            
  8305. /*         then shut down subtasks.                               */            
  8306. /******************************************************************/            
  8307.                                                                                 
  8308.  if (debugfp) {                                                                 
  8309.    fprintf(debugfp,"tsyncro...\n");                                             
  8310.    fflush(debugfp);                                                             
  8311.  }                                                                              
  8312.                                                                                 
  8313.  trc = tsyncro(MTF_ALL);                                                        
  8314.  if (trc != 0) {                                                                
  8315.    GGMmtfer(trc,"TSYNCRO");                                                     
  8316.  }                                                                              
  8317.                                                                                 
  8318.  if (debugfp) {                                                                 
  8319.    fprintf(debugfp,"tterm...\n");                                               
  8320.    fflush(debugfp);                                                             
  8321.  }                                                                              
  8322.                                                                                 
  8323.  trc = tterm();                                                                 
  8324.  if (trc != 4) {                                                                
  8325.    GGMmtfer(trc,"TTERM");                                                       
  8326.    exit(8);                                                                     
  8327.  }                                                                              
  8328.                                                                                 
  8329.  if (debugfp) fclose(debugfp);                                                  
  8330.                                                                                 
  8331.  exit(0);                                                                       
  8332.                                                                                 
  8333. }                                                                               
  8334. ./   ADD NAME=GGSTASK,SSI=01630058                                              
  8335.                                                                                 
  8336.  /********************************************************************/         
  8337.  /*                                                                  */         
  8338.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  8339.  /*                                                                  */         
  8340.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  8341.  /* including the implied warranties of merchantability and fitness, */         
  8342.  /* are expressly denied.                                            */         
  8343.  /*                                                                  */         
  8344.  /* Provided this copyright notice is included, this software may    */         
  8345.  /* be freely distributed and not offered for sale.                  */         
  8346.  /*                                                                  */         
  8347.  /* Changes or modifications may be made and used only by the maker  */         
  8348.  /* of same, and not further distributed.  Such modifications should */         
  8349.  /* be mailed to the author for consideration for addition to the    */         
  8350.  /* software and incorporation in subsequent releases.               */         
  8351.  /*                                                                  */         
  8352.  /********************************************************************/         
  8353.                                                                                 
  8354. #pragma  csect(code,  "GGSTASK ")                                               
  8355. #pragma  csect(static,"GG$TASK ")                                               
  8356.                                                                                 
  8357. #include "gg.h"                                                                 
  8358.                                                                                 
  8359. /*=================================================================*/           
  8360.                                                                                 
  8361. /*******************************************************************/           
  8362. /*                                                                 */           
  8363. /*    this is a debugging routine;  it looks at the status of a    */           
  8364. /*    socket.                                                      */           
  8365. /*******************************************************************/           
  8366.                                                                                 
  8367. static void                                                                     
  8368. lookatsocket(int sockfd)                                                        
  8369. {                                                                               
  8370.  int             rc;                       /* return code */                    
  8371.  int             length;                   /* length variable */                
  8372.  int             option;                                                        
  8373.  int             x;                                                             
  8374.  struct linger   l;                        /* linger structure */               
  8375.  char            buffer[RBUFSIZE];                                              
  8376.                                                                                 
  8377.  length = sizeof(l);                                                            
  8378.  if (Getsockopt(sockfd,SOL_SOCKET, SO_LINGER,&l,&length)==0) {                  
  8379.    printf("l_onoff=%d\n",l.l_onoff);                                            
  8380.    printf("l_linger=%d\n",l.l_linger);                                          
  8381.  }                                                                              
  8382.  else REPORT_TCP_ERROR("GETSOCKOPT");                                           
  8383.                                                                                 
  8384.  length = sizeof(option);                                                       
  8385.  if (Getsockopt(sockfd,SOL_SOCKET, SO_ERROR,&option,&length)==0) {              
  8386.    printf("so_error=%d\n",option);                                              
  8387.  }                                                                              
  8388.  else REPORT_TCP_ERROR("GETSOCKOPT");                                           
  8389.                                                                                 
  8390.  if (fcntl(sockfd,F_SETFL,FNDELAY)!=0) REPORT_TCP_ERROR("FCNTL");               
  8391.                                                                                 
  8392.  length = recv(sockfd,buffer,sizeof(buffer)-1,0);                               
  8393.  if (length == -1) {                                                            
  8394.    if (errno != EWOULDBLOCK) REPORT_TCP_ERROR("recv");                          
  8395.  }                                                                              
  8396.  else {                                                                         
  8397.    buffer[sizeof(buffer)-1] = 0;                                                
  8398.    printf("buffer =%s\n",buffer);                                               
  8399.    for (x=0;x<length;x++) printf("%x ",buffer[x]);                              
  8400.    printf("\n");                                                                
  8401.  }                                                                              
  8402.                                                                                 
  8403. }                                                                               
  8404.                                                                                 
  8405. /*******************************************************************/           
  8406.                                                                                 
  8407. /**************************************************************/                
  8408. /*    this routine processes the data once a connection       */                
  8409. /*    has been accepted.  It just takes the data sent by the  */                
  8410. /*    client and prints it to sysprint, then sends it back    */                
  8411. /*    to the client.                                          */                
  8412. /*                                                            */                
  8413. /*             INPUT:   newsockfd  - socket descriptor        */                
  8414. /*                      clid       - takesocket structure...  */                
  8415. /**************************************************************/                
  8416.                                                                                 
  8417. void                                                                            
  8418. GGSrecv(                                                                        
  8419. #ifdef SNSTCPIP                                                                 
  8420.  unsigned long      token,                                                      
  8421. #else                                                                           
  8422.  int                newsockfd,                                                  
  8423.  struct clientid    clid,                                                       
  8424. #endif                                                                          
  8425.  int                is_debug                                                    
  8426.        )                                                                        
  8427. {                                                                               
  8428.  struct recvstruct *R;                                                          
  8429.  struct hostent    *hostentp;                                                   
  8430.  char              *bufptr;   /* pointer into buffer strings         */         
  8431.  char              *hp;                                                         
  8432.  char             **halias;                                                     
  8433.  int                retcode;  /* return code                         */         
  8434.  int                len;      /* length of the buffer we're sent     */         
  8435.  int                x;        /* loop counter                        */         
  8436.  int                addrlen;  /* length of client address socket     */         
  8437.  int                hostlen;                                                    
  8438.  int                domslen;                                                    
  8439.  struct sockaddr_in clientaddress; /* address of client              */         
  8440.  struct recvstruct  r;                                                          
  8441.  time_t             timeval;                                                    
  8442.  struct tm         *tmp;                                                        
  8443.  char               outbuf[RBUFSIZE];  /* hold an output string */              
  8444.  char               timestamp[20];                                              
  8445.                                                                                 
  8446.  memset(&r, 0, sizeof(struct recvstruct));                                      
  8447.  R = &r;                                                                        
  8448.                                                                                 
  8449. #ifdef SNSTCPIP                                                                 
  8450.                                                                                 
  8451.  if (is_debug) {                                                                
  8452.    fprintf(stdout,"openold (token=%X)...\n",token);                             
  8453.    fflush(stdout);                                                              
  8454.  }                                                                              
  8455.  s0skcfg.exitfunc = NULL; /* Set exit address to NULL */                        
  8456.  R->sockfd = openold(token);                                                    
  8457.  if (is_debug) {                                                                
  8458.    fprintf(stdout,"sockfd from openold is %d\n", R->sockfd);                    
  8459.    fflush(stdout);                                                              
  8460.  }                                                                              
  8461.  if(R->sockfd < 0) {                                                            
  8462.    REPORT_TCP_ERROR("OPENOLD");                                                 
  8463.    fflush(stderr);                                                              
  8464.    return;                                                                      
  8465.  }                                                                              
  8466.                                                                                 
  8467. #else                                                                           
  8468.                                                                                 
  8469.  if (is_debug) {                                                                
  8470.    fprintf(stdout,"takesocket (newsockfd=%d)...\n",newsockfd);                  
  8471.    fprintf(stdout,"name is %8.8s, subtaskname is %8.8s\n",                      
  8472.                   clid.name,clid.subtaskname);                                  
  8473.    fflush(stdout);                                                              
  8474.  }                                                                              
  8475.                                                                                 
  8476.  R->sockfd = takesocket(&clid,newsockfd);                                       
  8477.  if (is_debug) {                                                                
  8478.    fprintf(stdout,"sockfd from takesocket is %d\n", R->sockfd);                 
  8479.    fflush(stdout);                                                              
  8480.  }                                                                              
  8481.  if(R->sockfd < 0) {                                                            
  8482.    REPORT_TCP_ERROR("TAKESOCKET");                                              
  8483.    return;                                                                      
  8484.  }                                                                              
  8485.                                                                                 
  8486. #endif                                                                          
  8487.                                                                                 
  8488.  time(&timeval);                                                                
  8489.  tmp = localtime(&timeval);                                                     
  8490.  sprintf(timestamp,"%2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d",                       
  8491.          tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_year,                           
  8492.          tmp->tm_hour, tmp->tm_min, tmp->tm_sec);                               
  8493.                                                                                 
  8494.  if (is_debug) {                                                                
  8495.    fprintf(stdout,"getpeername...\n");                                          
  8496.    fflush(stdout);                                                              
  8497.  }                                                                              
  8498.                                                                                 
  8499.  addrlen = sizeof(clientaddress);                                               
  8500.  if(Getpeername(R->sockfd,&clientaddress,&addrlen)!=0) {                        
  8501.    REPORT_TCP_ERROR("GETPEERNAME");                                             
  8502.    printf("could not determine client address for socket %d\n",                 
  8503.           R->sockfd);                                                           
  8504.  }                                                                              
  8505.                                                                                 
  8506.  /* Try to get the name of the client host. */                                  
  8507.                                                                                 
  8508.  strcpy(R->hostname,"{UNKNOWN HOST NAME}");                                     
  8509.                                                                                 
  8510.  if (is_debug) {                                                                
  8511.    fprintf(stdout,"gethostbyaddr...\n");                                        
  8512.    fflush(stdout);                                                              
  8513.  }                                                                              
  8514.                                                                                 
  8515.  hostentp = Gethostbyaddr(&clientaddress.sin_addr,                              
  8516.                           sizeof(clientaddress.sin_addr),                       
  8517.                           AF_INET);                                             
  8518.                                                                                 
  8519.  if (hostentp && hostentp->h_name) {                                            
  8520.    memcpy(&R->clienthostent, hostentp, sizeof(struct hostent));                 
  8521.    strcpy(R->hostname,hostentp->h_name);                                        
  8522.    uppercase_in_place(R->hostname);                                             
  8523.  }                                                                              
  8524.                                                                                 
  8525.  strcpy(R->hosttest,R->hostname);                                               
  8526.                                                                                 
  8527.  hostlen = strlen(R->hosttest);                                                 
  8528.  domslen = sizeof(MY_DOMAIN_SUFFIX) - 1;                                        
  8529.  if (hostlen > domslen) {                                                       
  8530.    hp = R->hosttest + hostlen - domslen;                                        
  8531.    if (!memcmp(hp, MY_DOMAIN_SUFFIX, domslen)) {                                
  8532.      *hp = '\0';                                                                
  8533.    }                                                                            
  8534.  }                                                                              
  8535.                                                                                 
  8536.  printf("%s Connection from %s (%s, aka %s).  Socket %d\n",                     
  8537.         timestamp,                                                              
  8538.         inet_ntoa(clientaddress.sin_addr), R->hostname, R->hosttest,            
  8539.         R->sockfd);                                                             
  8540.                                                                                 
  8541.  /* This still doesn't do anything.                                             
  8542.   *                                                                             
  8543.   * if (hostentp && hostentp->h_name) {                                         
  8544.   *   memcpy(&R->clienthostent, hostentp, sizeof(struct hostent));              
  8545.   *   for (halias = R->clienthostent.h_aliases; *halias; halias++) {            
  8546.   *     printf("  Host alias:'%s'\n",*halias);                                  
  8547.   *   }                                                                         
  8548.   * }                                                                           
  8549.   */                                                                            
  8550.                                                                                 
  8551.  R->buffer[0] = '\0';                                                           
  8552.  bufptr = R->buffer;                                                            
  8553.                                                                                 
  8554. /***********************/                                                       
  8555. /*  NOTE:  sometimes, if timing is right, RECV can return a 0 length */         
  8556. /* record when a connection is closed by the client!!  below is a   */          
  8557. /* hack to check for a 0 length record, and then terminate this     */          
  8558. /* connection if we got one.                                        */          
  8559. /***********************/                                                       
  8560.                                                                                 
  8561. #define RECV_SIZE       (sizeof(R->buffer)-1)                                   
  8562.                                                                                 
  8563.  for (;;) {                                                                     
  8564.                                                                                 
  8565.    if (is_debug) {                                                              
  8566.      fprintf(stdout,"recv (sock=%d,size=%d)...\n",R->sockfd,RECV_SIZE);         
  8567.      fflush(stdout);                                                            
  8568.    }                                                                            
  8569.                                                                                 
  8570.    if ((len=recv(R->sockfd,outbuf,RECV_SIZE,0)) <= 0) {                         
  8571.      REPORT_TCP_ERROR("RECV - ");                                               
  8572.      printf("%s tcp error! len=%d\n",R->hostname, len);                         
  8573.      break;                                                                     
  8574.    }                                                                            
  8575.                                                                                 
  8576.    *(outbuf+(len))=0;    /*make sure it's null terminated...*/                  
  8577.    /* printf("len=%d;",len); */                                                 
  8578.    ASCII_TO_EBCDIC(outbuf,len);                                                 
  8579.    if (strlen(R->buffer) + strlen(outbuf) >= sizeof(R->buffer)) {               
  8580.      printf("\nError: More than %d bytes seen without CRLF\n",                  
  8581.             sizeof(R->buffer)-1);                                               
  8582.      len = 0;                                                                   
  8583.      break;                                                                     
  8584.    }                                                                            
  8585.    strcat(R->buffer,outbuf);                                                    
  8586.    bufptr=R->buffer+(strlen(R->buffer)-2);                                      
  8587.    if (*bufptr == CARRIAGE_RETURN && *(bufptr+1) == LINE_FEED) break;           
  8588.  }                                                                              
  8589.                                                                                 
  8590.  /* Note: no \n required, data line already has CRLF in it */                   
  8591.  fprintf(stderr,"%s %s Client data:%s",                                         
  8592.                 timestamp, R->hostname, R->buffer);                             
  8593.                                                                                 
  8594.  if (len < 0) return;                                                           
  8595.  else if (len == 0) {                                                           
  8596.    (void)GGMouts(R,                                                             
  8597.   "1Sorry, the GOPHER server couldn't hear you.  Try again.\t0\t0\t0");         
  8598.  }                                                                              
  8599.  else (void)GGMproc(R);                                                         
  8600.                                                                                 
  8601.  (void)GGMouts(R,NULL);          /* send terminating dot */                     
  8602.                                                                                 
  8603.  fflush(stdout);                                                                
  8604.  fflush(stderr);                                                                
  8605.                                                                                 
  8606. #ifdef DEBUGMTF                                                                 
  8607.  lookatsocket(R->sockfd);                                                       
  8608. #endif                                                                          
  8609.                                                                                 
  8610.  if (is_debug) {                                                                
  8611.    fprintf(stdout,"close (%d)...\n",R->sockfd);                                 
  8612.    fflush(stdout);                                                              
  8613.  }                                                                              
  8614.                                                                                 
  8615.  if(close(R->sockfd)<0) REPORT_TCP_ERROR("CLOSE - ");                           
  8616.                                                                                 
  8617. }                                                                               
  8618. ./ ENDUP                                                                        
  8619. ?!                                                                              
  8620. //CLIST    EXEC GGLOAD,TRK1='4',TO='CLIST'                                      
  8621. //SYSIN    DD DATA,DLM='?!'                                                     
  8622. ./   ADD NAME=GOPHER,SSI=010F0028                                               
  8623. /* REXX. GOPHER client.  */                                                     
  8624.                                                                                 
  8625. /* *** Customize the following lines for your installation.                     
  8626.  * If ggmpanel is set to "", it will not be LIBDEF'd.                           
  8627.  */                                                                             
  8628.                                                                                 
  8629. ggmprefix      = "GOPHER"                                                       
  8630. ggmpanelsuffix = "PANELS"                                                       
  8631. ggmloadsuffix  = "LOAD"                                                         
  8632. ggmlmod        = "GGCLIENT"                                                     
  8633. ggmpanel       = ggmprefix"."ggmpanelsuffix                                     
  8634. ggmload        = ggmprefix"."ggmloadsuffix                                      
  8635. ggmappl        = ""                     /* ISPF applid (e.g. ISR)  */           
  8636. ggmdefaulthost = "gopher.micro.umn.edu" /* to initialize GOPHERRC  */           
  8637. gophermeister  = ""              /* TSOid of Gopher's Big Brother  */           
  8638. xprocavailable = 0               /* set to 1 if XPROC is available */           
  8639.                                                                                 
  8640. trace off                                                                       
  8641. signal on novalue                                                               
  8642. stacked   = 0                                                                   
  8643. libdeffed = 0                                                                   
  8644. parse arg args                                                                  
  8645. "ISPQRY"                                                                        
  8646. if rc > 0 then do                                                               
  8647.  parse source . . execname . execds .                                           
  8648.  if execds = "?" then                                                           
  8649.   icmd = "%"execname args                                                       
  8650.  else                                                                           
  8651.   icmd = "EX '"execds"("execname")'" quote(args)                                
  8652.  call startispf ggmappl, icmd                                                   
  8653.  exit                                                                           
  8654. end                                                                             
  8655.                                                                                 
  8656. if xprocavailable then do                                                       
  8657.                                                                                 
  8658.  save_prompt = prompt("ON")                                                     
  8659.  "XPROC 0 TEST DEBUG FORCE LOCAL SERVER() PORT() PATH() DESCRIPTION()"          
  8660.  if rc <> 0 then exit rc                                                        
  8661.  call prompt save_prompt                                                        
  8662.                                                                                 
  8663. end                                                                             
  8664.                                                                                 
  8665. else do /* XPROC not available */                                               
  8666.                                                                                 
  8667.  server = ""                                                                    
  8668.  port = 70                                                                      
  8669.  path  =                                                                        
  8670.  description =                                                                  
  8671.  local =                                                                        
  8672.  force =                                                                        
  8673.  test  =                                                                        
  8674.  debug =                                                                        
  8675.  uargs = translate(args)                                                        
  8676.  if wordpos("LOCAL",uargs) > 0 then local = "LOCAL"                             
  8677.  if wordpos("FORCE",uargs) > 0 then force = "FORCE"                             
  8678.  if wordpos("TEST" ,uargs) > 0 then test  = "TEST"                              
  8679.  if wordpos("DEBUG",uargs) > 0 then debug = "DEBUG"                             
  8680.                                                                                 
  8681. end                                                                             
  8682.                                                                                 
  8683. signal on failure                                                               
  8684. signal on halt                                                                  
  8685.                                                                                 
  8686. call check_for_other_socket_app                                                 
  8687. call read_gopherrc                                                              
  8688. call validate_operands                                                          
  8689. call libdef                                                                     
  8690. call let_me_know                                                                
  8691. call ggm_dialog                                                                 
  8692. call unlibdef                                                                   
  8693.                                                                                 
  8694. cleanup:                                                                        
  8695. if libdeffed then call unlibdef                                                 
  8696. if stacked then "DELSTACK"                                                      
  8697. exit                                                                            
  8698. error:failure:halt:say "GOPHER: Severe lossage."                                
  8699. say "Statement:" sourceline(sigl)                                               
  8700. exit                                                                            
  8701.                                                                                 
  8702. /*********************************************************************/         
  8703.                                                                                 
  8704. validate_operands:                                                              
  8705.                                                                                 
  8706. /*                                                                              
  8707.  * Logic that determines what to display on startup:                            
  8708.  * If gopherrc file does not exist, create it from default                      
  8709.  * (default has everything commented out except for a                           
  8710.  *  one-item "initial" menu pointing to the MVS server)                         
  8711.  * Read gopherrc (in case operands need fields therein)                         
  8712.  * Command operands override gopherrc specs:                                    
  8713.  * if LOCAL given then server = "-", see below for SERVER(-)                    
  8714.  * if SERVER(host) given then startup host=SERVER, path=PATH, etc.              
  8715.  *  (no gopherrc referenced)                                                    
  8716.  * if SERVER(-) given then either PATH must be given or                         
  8717.  *  the gopherrc's localmenu: must be given,                                    
  8718.  *  otherwise look at gopherrc                                                  
  8719.  *   if LOCAL given and initial: present then extract startup menu              
  8720.  *    but remember that there will be no server access possible                 
  8721.  *   else nothing given, this is an error, barf                                 
  8722.  * if no SERVER, look at gopherrc:                                              
  8723.  *   if initial: given then extract startup menu from there                     
  8724.  *   else if localmenu: given then use that menu (SERVER=-)                     
  8725.  *   else nothing given, display ISPF panel asking for host/path                
  8726.  */                                                                             
  8727.                                                                                 
  8728. if local = "LOCAL" then do                                                      
  8729.  if server <> "" then do                                                        
  8730.   say "GOPHER: SERVER cannot be specified when LOCAL is specified."             
  8731.   exit 12                                                                       
  8732.  end                                                                            
  8733.  server = "-"                                                                   
  8734. end                                                                             
  8735.                                                                                 
  8736. ggpath = ""                                                                     
  8737. gghost = ""                                                                     
  8738. ggport = port                                                                   
  8739. ggdesc = description                                                            
  8740.                                                                                 
  8741. if server <> "" then do                                                         
  8742.  if server = "-" then do                                                        
  8743.   gghost = server                                                               
  8744.   if path <> "" then do                                                         
  8745.    ggpath = path                                                                
  8746.   end                                                                           
  8747.   else if localmenu <> "" then do                                               
  8748.    ggpath = localmenu                                                           
  8749.    if ggdesc = "" then ggdesc = "Local Private Gopher Menu"                     
  8750.   end                                                                           
  8751.   else if local = "LOCAL" & initial <> "" then do                               
  8752.    gghost = ""                                                                  
  8753.    call use_initial_spec                                                        
  8754.    if gghost <> "-" then do                                                     
  8755.     say "Gopher: Cannot determine path for local access."                       
  8756.     say "        Either specify PATH(pathname), activate"                       
  8757.     say "        the localmenu: line in GOPHERRC, or set"                       
  8758.     say "        the initial: line in GOPHERRC for local access."               
  8759.     exit 12                                                                     
  8760.    end                                                                          
  8761.   end                                                                           
  8762.   else do                                                                       
  8763.    say "Gopher: Cannot determine path for local access."                        
  8764.    say "        Either specify PATH(pathname) or activate"                      
  8765.    say "        the localmenu: or initial: line in GOPHERRC."                   
  8766.    exit 12                                                                      
  8767.   end                                                                           
  8768.  end                                                                            
  8769.  else do                                                                        
  8770.   gghost = server                                                               
  8771.   ggpath = path                                                                 
  8772.   ggdesc = description                                                          
  8773.   ggport = port                                                                 
  8774.   nop  /* use provided server, host, path, etc. */                              
  8775.  end                                                                            
  8776. end                                                                             
  8777. else do       /* no server given on command */                                  
  8778.  if localmenu <> "" then do                                                     
  8779.   gghost = "-"                                                                  
  8780.   ggpath = localmenu                                                            
  8781.   if ggdesc = "" then ggdesc = "Local Private Gopher Menu"                      
  8782.  end                                                                            
  8783.  else if initial <> "" then do                                                  
  8784.   call use_initial_spec                                                         
  8785.  end                                                                            
  8786.  else do                                                                        
  8787.   /* this is nominally illegal, but should cause gopher to                      
  8788.      display the hackish startup menu */                                        
  8789.   gghost = ""                                                                   
  8790.   ggpath = ""                                                                   
  8791.  end                                                                            
  8792. end                                                                             
  8793.                                                                                 
  8794. return                                                                          
  8795.                                                                                 
  8796. /*********************************************************************/         
  8797.                                                                                 
  8798. use_initial_spec:                                                               
  8799.                                                                                 
  8800.  if initial = "*temp*" then do                                                  
  8801.   /* we're eventually not going to do it this way really */                     
  8802.   /* initial_type is ignored - only "DIRECTORY" is valid anyway */              
  8803.   if initial_name <> "" & ggdesc = "" then ggdesc = initial_name                
  8804.   if initial_host <> "" & gghost = "" then gghost = initial_host                
  8805.   if initial_path <> "" & ggpath = "" then ggpath = initial_path                
  8806.   if initial_port <> "" & ggport = "" then ggport = initial_port                
  8807.  end                                                                            
  8808.  else do                                                                        
  8809.   ggpath = initial                                                              
  8810.   if ggdesc = "" then ggdesc = "Local Private Gopher Menu"                      
  8811.  end                                                                            
  8812.                                                                                 
  8813. return                                                                          
  8814.                                                                                 
  8815. /*********************************************************************/         
  8816.                                                                                 
  8817. read_gopherrc:                                                                  
  8818.                                                                                 
  8819. localmenu = ""                                                                  
  8820. localexec = ""                                                                  
  8821. initial   = ""                                                                  
  8822. initial_type = ""                                                               
  8823. initial_name = ""                                                               
  8824. initial_host = ""                                                               
  8825. initial_path = ""                                                               
  8826. initial_port = ""                                                               
  8827. new_gopherrc = 0                                                                
  8828. gopherrc = "'"userid()".GOPHERRC'"                                              
  8829. gopherdcb = "RECFM(V B) LRECL(255) BLKSIZE(6233) DSORG(PS)"                     
  8830. gopherrc_status = sysdsn(gopherrc)                                              
  8831. select                                                                          
  8832.  when gopherrc_status = "OK" then nop                                           
  8833.  when gopherrc_status = "DATASET NOT FOUND" then do                             
  8834.   address TSO "ALLOC DA("gopherrc") T SP(1 1)" gopherdcb                        
  8835.   if rc <> 0 then do                                                            
  8836.    say "Error: Cannot create" gopherrc                                          
  8837.    exit rc                                                                      
  8838.   end                                                                           
  8839.   new_gopherrc = 1                                                              
  8840.  end                                                                            
  8841.  otherwise do                                                                   
  8842.   say "Error: Cannot access" gopherrc":" gopherrc_status                        
  8843.   exit 16                                                                       
  8844.  end                                                                            
  8845. end                                                                             
  8846.                                                                                 
  8847. address TSO "ALLOC FI(GOPHERRC) DA("gopherrc") OLD REU"                         
  8848. if rc <> 0 then exit rc                                                         
  8849.                                                                                 
  8850. if new_gopherrc = 0 then do                                                     
  8851.  "EXECIO * DISKR GOPHERRC (FINIS STEM GOPHERRC.)"                               
  8852.  execiorc = rc                                                                  
  8853.  if execiorc <> 0 then do                                                       
  8854.   say "Error: Cannot read" gopherrc                                             
  8855.   address TSO "FREE FI(GOPHERRC)"                                               
  8856.   exit execiorc                                                                 
  8857.  end                                                                            
  8858.  if gopherrc.0 = 0 then new_gopherrc = 1                                        
  8859. end                                                                             
  8860.                                                                                 
  8861. if new_gopherrc then call initialize_gopherrc                                   
  8862.                                                                                 
  8863. address TSO "FREE FI(GOPHERRC)"                                                 
  8864.                                                                                 
  8865. collecting_initial = 0                                                          
  8866. do i = 1 to gopherrc.0                                                          
  8867.  gline = gopherrc.i                                                             
  8868.  if gline = "" then iterate                                                     
  8869.  if left(gline,1) = '#' then iterate                                            
  8870.  parse var gline ghead ":" gtext                                                
  8871.  ghead = translate(strip(ghead,"B"))                                            
  8872.  gtext = strip(gtext,"B")                                                       
  8873.  if collecting_initial then do                                                  
  8874.   parse var gline ghead "=" gtext                                               
  8875.   ghead = translate(strip(ghead,"B"))                                           
  8876.   gtext = strip(gtext,"B")                                                      
  8877.   select                                                                        
  8878.    when ghead = "TYPE" then initial_type = gtext                                
  8879.    when ghead = "NAME" then initial_name = gtext                                
  8880.    when ghead = "PATH" then initial_path = gtext                                
  8881.    when ghead = "HOST" then initial_host = gtext                                
  8882.    when ghead = "PORT" then initial_port = gtext                                
  8883.    when ghead = "END"  then do                                                  
  8884.     collecting_initial = 0                                                      
  8885.     initial = "*temp*"                                                          
  8886.    end                                                                          
  8887.    otherwise do                                                                 
  8888.     say "Error in "gopherrc": INITIAL: not terminated by END"                   
  8889.     say "Line where error was detected:"                                        
  8890.     say gline                                                                   
  8891.     exit 8                                                                      
  8892.    end                                                                          
  8893.   end                                                                           
  8894.  end                                                                            
  8895.  else select                                                                    
  8896.   when ghead = "LOCALMENU" then localmenu = gtext                               
  8897.   when ghead = "LOCALEXEC" then localexec = gtext                               
  8898.   when ghead = "INITIAL"   then do                                              
  8899.    if gtext = "" then collecting_initial = 1                                    
  8900.    else initial = gtext                                                         
  8901.   end                                                                           
  8902.   otherwise do                                                                  
  8903.    say "Warning, gopherrc field ignored:" ghead                                 
  8904.   end                                                                           
  8905.  end                                                                            
  8906. end                                                                             
  8907.                                                                                 
  8908. return                                                                          
  8909.                                                                                 
  8910. /*********************************************************************/         
  8911.                                                                                 
  8912. ggm_dialog:                                                                     
  8913.                                                                                 
  8914. vputvars = "GGHOST GGPORT GGPATH GGDESC"                                        
  8915.                                                                                 
  8916. if vputvars <> "" then do                                                       
  8917.  address ISPEXEC "VPUT ("vputvars") PROFILE"                                    
  8918.  if rc <> 0 then do; call ispf_error rc; exit rc; end                           
  8919. end                                                                             
  8920.                                                                                 
  8921. parm = ""                                                                       
  8922. if test  = "TEST"  then parm = parm "-t"                                        
  8923. if debug = "DEBUG" then parm = parm "-d"                                        
  8924. if local = "LOCAL" then parm = parm "-l"                                        
  8925. if gghost <> ""    then parm = parm "-q"                                        
  8926.                                                                                 
  8927. zerrmsg = ""                                                                    
  8928. zerrsm  = ""                                                                    
  8929. zerrlm  = ""                                                                    
  8930.                                                                                 
  8931. if ggmappl = "" then applsource = ""                                            
  8932. else applsource = "NEWAPPL("ggmappl") PASSLIB"                                  
  8933.                                                                                 
  8934. if ggmload = "" then selstring = "PGM("ggmlmod") PARM("parm")"                  
  8935. else selstring = "CMD(CALL '"ggmload"("ggmlmod")'" quote(parm)")"               
  8936.                                                                                 
  8937. address ISPEXEC "SELECT" applsource selstring                                   
  8938.                                                                                 
  8939. if rc <> 0 then say "Return code from" ggmlmod "program is" rc                  
  8940.                                                                                 
  8941. address ISPEXEC "VGET (ZERRSM ZERRLM)"                                          
  8942. if zerrsm <> "" then do                                                         
  8943.  say zerrmsg":" zerrsm                                                          
  8944.  say zerrlm                                                                     
  8945. end                                                                             
  8946.                                                                                 
  8947. return                                                                          
  8948.                                                                                 
  8949. /*********************************************************************/         
  8950.                                                                                 
  8951. libdef:                                                                         
  8952. if ggmpanel <> "" then do                                                       
  8953.  address ISPEXEC "LIBDEF ISPPLIB DATASET ID('"ggmpanel"')"                      
  8954.  if rc <> 0 then do; call ispf_error rc; exit rc; end                           
  8955. end                                                                             
  8956. if localexec <> "" then do                                                      
  8957.  address TSO "ALLOC FI(GGEXEC) SHR REU DA('"localexec"')"                       
  8958.  if rc <> 0 then exit rc                                                        
  8959. end                                                                             
  8960. libdeffed = 1                                                                   
  8961. return                                                                          
  8962.                                                                                 
  8963. /*********************************************************************/         
  8964.                                                                                 
  8965. unlibdef:                                                                       
  8966. if localexec <> "" then do                                                      
  8967.  address TSO "FREE FI(GGEXEC)"                                                  
  8968. end                                                                             
  8969. if ggmpanel <> "" then do                                                       
  8970.  address ISPEXEC "LIBDEF ISPPLIB DATASET"                                       
  8971.  if rc <> 0 then call ispf_error rc                                             
  8972. end                                                                             
  8973. libdeffed = 0                                                                   
  8974. return                                                                          
  8975.                                                                                 
  8976. /*********************************************************************/         
  8977.                                                                                 
  8978. initialize_gopherrc:                                                            
  8979.                                                                                 
  8980.  say "Initializing new GOPHERRC file..."                                        
  8981.  do i = sigl while sourceline(i) <> "_BEGIN_"                                   
  8982.  end                                                                            
  8983.  gx = 0                                                                         
  8984.  do i = i+1 by 1                                                                
  8985.   gline = sourceline(i)                                                         
  8986.   if gline = "_END_" then leave                                                 
  8987.   gpos = pos("ggmdefaulthost",gline)                                            
  8988.   if gpos > 0 then do                                                           
  8989.    gline = substr(gline,1,gpos-1) || ggmdefaulthost                             
  8990.   end                                                                           
  8991.   gx = gx + 1                                                                   
  8992.   gopherrc.gx = gline                                                           
  8993.  end                                                                            
  8994.  gopherrc.0 = gx                                                                
  8995.  "EXECIO * DISKW GOPHERRC (FINIS STEM GOPHERRC.)"                               
  8996.  say "New GOPHERRC file initialized."                                           
  8997.                                                                                 
  8998. return                                                                          
  8999.                                                                                 
  9000. /*                                                                              
  9001.                                                                                 
  9002. _BEGIN_                                                                         
  9003. #                                                                               
  9004. #                                                                               
  9005. # Default "gopherrc" file, created by the MVS Gopher client.                    
  9006. #                                                                               
  9007. # Uncomment desired fields by removing the initial "# " from them.              
  9008. #                                                                               
  9009. # Beware - the Gopher client may update this file with bookmarks.               
  9010. #          You can delete it at any time and it will be recreated               
  9011. #          from the default settings, but you'll lose your bookmarks.           
  9012. #                                                                               
  9013. ######################################################################          
  9014. #                                                                               
  9015. # If you want local (serverless) gopher access, then use the following          
  9016. # lines, specifying full qualified (no quotes) data set names:                  
  9017. #                                                                               
  9018. # localmenu: name_of_initial_gopher_menu                                        
  9019. # localexec: name_of_pds_of_rexx_execs                                          
  9020. #                                                                               
  9021. # Specifying localmenu: is equivalent to specifying an initial: section         
  9022. # with host set to "-" and path set to the value of localmenu.                  
  9023. #                                                                               
  9024. # You cannot use your own REXX execs, however, unless you specify               
  9025. # localexec: as above.  You don't need one to use the other, though.            
  9026. #                                                                               
  9027. ######################################################################          
  9028. #                                                                               
  9029. # The following is used by the Gopher client at startup to determine            
  9030. # how the initial menu will appear.                                             
  9031. #                                                                               
  9032. # You may want to change the host to the one appropriate for your site.         
  9033. #                                                                               
  9034. initial:                                                                        
  9035. #                                                                               
  9036. Type=DIRECTORY                                                                  
  9037. Name=Primary (Root) Gopher Menu                                                 
  9038. Path=                                                                           
  9039. Host=ggmdefaulthost                                                             
  9040. Port=70                                                                         
  9041. End                                                                             
  9042. #                                                                               
  9043. # Alternatively, if you want your own private Gopher data:                      
  9044. #                                                                               
  9045. # initial:                                                                      
  9046. #                                                                               
  9047. # Type=0                                                                        
  9048. # Name=My Own Private Gopherhole                                                
  9049. # Path=userid.GOPHER.MENU                                                       
  9050. # Host=-                                                                        
  9051. # End                                                                           
  9052. #                                                                               
  9053. # In which case you should create a data set called userid.GOPHER.MENU          
  9054. # (or whatever name you choose that appears in the "Path=" line above)          
  9055. # that looks like this.  (NOT in the gopherrc file!)                            
  9056. #                                                                               
  9057. #                                                                               
  9058. # gopher_menu                                                                   
  9059. #                                                                               
  9060. # TYPE=DIRECTORY                                                                
  9061. # NAME=Public GOPHER Server at ggmdefaulthost                                   
  9062. # PATH=                                                                         
  9063. # HOST=ggmdefaulthost                                                           
  9064. # END                                                                           
  9065. #                                                                               
  9066. # TYPE=DIRECTORY                                                                
  9067. # NAME=Private GOPHER                                                           
  9068. # PATH=userid.ANOTHER.GOPHER.MENU                                               
  9069. # HOST=-                                                                        
  9070. # END                                                                           
  9071. #                                                                               
  9072. # and then you need yet another menu, similar in format to this one,            
  9073. # in userid.ANOTHER.GOPHER.MENU.  Get the idea?                                 
  9074. #                                                                               
  9075. ######################################################################          
  9076. #                                                                               
  9077. # These fields may be used by the Gopher client for local purposes              
  9078. # in the future.  Currently they are ignored.                                   
  9079. #                                                                               
  9080. # Printercmd: lpr                                                               
  9081. # Telnetcmd: telnet                                                             
  9082. # Mailcmd: mail                                                                 
  9083. # Playcmd: play -v 40 -                                                         
  9084. # TN3270cmd: tn3270                                                             
  9085. # MIMEcmd: metamail -p                                                          
  9086. #                                                                               
  9087. ######################################################################          
  9088. _END_                                                                           
  9089.                                                                                 
  9090. */                                                                              
  9091.                                                                                 
  9092. /*********************************************************************/         
  9093.                                                                                 
  9094. check_for_other_socket_app:                                                     
  9095.                                                                                 
  9096.  if local = "LOCAL" then return                                                 
  9097.                                                                                 
  9098.  call nnmfiucv      /* FIND IUCVMULT in another PIE MultiTSO session */         
  9099.                                                                                 
  9100.  if result = 0 then return                                                      
  9101.                                                                                 
  9102.  say,                                                                           
  9103.  "A TCP/IP socket application appears active in another PIE session."           
  9104.  if force = "FORCE" then do                                                     
  9105.   say "Proceeding anyhow, because you said FORCE."                              
  9106.   return                                                                        
  9107.  end                                                                            
  9108.  say "To proceed at this point would be potentially disastrous."                
  9109.  say "If you want to use GOPHER anyway, use one of these operands:"             
  9110.  say "  FORCE  -  if I'm mistaken and it's really safe to make a"               
  9111.  say "            TCP/IP connection."                                           
  9112.  say "  LOCAL  -  if you just want local (serverless) access."                  
  9113.  say "Terminating."                                                             
  9114.                                                                                 
  9115. exit 16                                                                         
  9116.                                                                                 
  9117. /*********************************************************************/         
  9118.                                                                                 
  9119. ispf_error: parse arg ispfrc                                                    
  9120.                                                                                 
  9121. say "GOPHER: ISPF dialog service error detected on line" sigl                   
  9122. say sourceline(sigl)                                                            
  9123. say                                                                             
  9124. say zerrmsg":" zerrsm                                                           
  9125. say zerrlm                                                                      
  9126. say                                                                             
  9127.                                                                                 
  9128. return ispfrc                                                                   
  9129.                                                                                 
  9130. /*********************************************************************/         
  9131.                                                                                 
  9132. /*                                                                              
  9133.  * The following function starts ISPF from READY mode.                          
  9134.  * Beware:  splitting the screen starts up an identical copy of the             
  9135.  *          application, which may not be desirable.                            
  9136.  */                                                                             
  9137.                                                                                 
  9138. startispf: parse arg startappl, startcmd                                        
  9139. if startappl = "" then,                                                         
  9140.  "ISPSTART CMD("startcmd")"                                                     
  9141. else,                                                                           
  9142.  "ISPSTART NEWAPPL("startappl") CMD("startcmd")"                                
  9143. return                                                                          
  9144.                                                                                 
  9145. /* The following function implements Big Brother mode. */                       
  9146.                                                                                 
  9147. let_me_know:                                                                    
  9148. if gophermeister = "" | gophermeister = userid() then return                    
  9149. parse source . . execname . execds .                                            
  9150. call outtrap "X."                                                               
  9151. address TSO,                                                                    
  9152.  "SEND" quote(execds"("execname")" date("U") time()" "),                        
  9153.         "U("gophermeister") LOGON"                                              
  9154. call outtrap "OFF"                                                              
  9155. return                                                                          
  9156.                                                                                 
  9157. /* The following function enquotes a string. */                                 
  9158.                                                                                 
  9159. quote: parse arg string                                                         
  9160. ix = 1                                                                          
  9161. do forever                                                                      
  9162.  ix = pos("'",string,ix)                                                        
  9163.  if ix = 0 then return "'"string"'"                                             
  9164.  string = insert("'",string,ix)                                                 
  9165.  ix=ix+2                                                                        
  9166. end                                                                             
  9167.                                                                                 
  9168. ./   ADD NAME=NNMFIUCV,SSI=01000017                                             
  9169. /* REXX.  This exec scans the job pack queues for IUCVMULT and returns          
  9170.  * with an error code if IUCVMULT is already loaded under a                     
  9171.  * different TCB. This can only happen under PIE MultiTSO or a                  
  9172.  * similar product that makes multiple job step TCB's.                          
  9173.  */                                                                             
  9174.                                                                                 
  9175. trace off                                                                       
  9176. signal on novalue                                                               
  9177.                                                                                 
  9178. search_name = "IUCVMULT"                                                        
  9179. count = 0                                                                       
  9180. foundtcb. = ""                                                                  
  9181. current_tcb  = getword24("21C")                                                 
  9182. current_job_step_tcb = getword24(current_tcb,"7C")                              
  9183. current_ascb = getword24("224")                                                 
  9184. current_asxb = getword31(current_ascb,"6C")                                     
  9185. first_tcb    = getword24(current_asxb,"4")                                      
  9186. tcb = first_tcb                                                                 
  9187. motherflag = 0                                                                  
  9188. do forever                                                                      
  9189.  if motherflag = 0 then do                                                      
  9190.   call process                                                                  
  9191.   daughter_tcb = getword24(tcb,"88")                                            
  9192.   if daughter_tcb \= "00000000" then do                                         
  9193.    tcb = daughter_tcb                                                           
  9194.    iterate                                                                      
  9195.   end                                                                           
  9196.  end                                                                            
  9197.  motherflag = 0                                                                 
  9198.  sister_tcb = getword24(tcb, "80")                                              
  9199.  if sister_tcb \= "00000000" then do                                            
  9200.   tcb = sister_tcb                                                              
  9201.   iterate                                                                       
  9202.  end                                                                            
  9203.  mother_tcb = getword24(tcb, "84")                                              
  9204.  if mother_tcb \= "00000000" then do                                            
  9205.   tcb = mother_tcb                                                              
  9206.   motherflag = 1                                                                
  9207.   iterate                                                                       
  9208.  end                                                                            
  9209.  leave                                                                          
  9210. end                                                                             
  9211.                                                                                 
  9212. if count = 0 then return 0                                                      
  9213. problem = 0                                                                     
  9214. do i = 1 to count                                                               
  9215.  if foundtcb.i = current_job_step_tcb then do                                   
  9216.   /*                                                                            
  9217.   say search_name "is already loaded under current TCB at "foundtcb.i"."        
  9218.   */                                                                            
  9219.  end                                                                            
  9220.  else do                                                                        
  9221.   /*                                                                            
  9222.   say search_name "is loaded under different TCB at "foundtcb.i"."              
  9223.   */                                                                            
  9224.   problem = 1                                                                   
  9225.  end                                                                            
  9226. end                                                                             
  9227.                                                                                 
  9228. if problem = 1 then return 1                                                    
  9229.                                                                                 
  9230. else return 0                                                                   
  9231.                                                                                 
  9232. process:                                                                        
  9233.                                                                                 
  9234.  jpq = getword31(tcb,"2C")                                                      
  9235.  cde = jpq                                                                      
  9236.  do while cde \= "00000000"                                                     
  9237.   cde_contents = storage(cde,32)                                                
  9238.   cde_name = substr(cde_contents,9,8)                                           
  9239.   cde_epa  = substr(cde_contents,9,8)                                           
  9240.   if search_name = cde_name then do                                             
  9241.    count = count + 1                                                            
  9242.    foundtcb.count = tcb                                                         
  9243.   end                                                                           
  9244.   cde = getword31(cde,"0")                                                      
  9245.  end                                                                            
  9246.                                                                                 
  9247. return                                                                          
  9248.                                                                                 
  9249. getword31: parse arg addr, offset                                               
  9250. temp1 = x2d(addr)                                                               
  9251. if offset = "" then temp2 = 0                                                   
  9252. else temp2 = x2d(offset)                                                        
  9253. return c2x(storage(d2x(temp1+temp2),4))                                         
  9254.                                                                                 
  9255. getword24: parse arg addr, offset                                               
  9256. temp1 = x2d(addr)                                                               
  9257. if offset = "" then temp2 = 0                                                   
  9258. else temp2 = x2d(offset)                                                        
  9259. return "00"c2x(storage(d2x(temp1+temp2+1),3))                                   
  9260.                                                                                 
  9261. ./ ENDUP                                                                        
  9262. ?!                                                                              
  9263. //H        EXEC GGLOAD,TRK1='4',TO='H'                                          
  9264. //SYSIN    DD DATA,DLM='?!'                                                     
  9265. ./   ADD NAME=GG,SSI=013F0021                                                   
  9266.                                                                                 
  9267.  /********************************************************************/         
  9268.  /*                                                                  */         
  9269.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  9270.  /*                                                                  */         
  9271.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  9272.  /*                                                                  */         
  9273.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  9274.  /* including the implied warranties of merchantability and fitness, */         
  9275.  /* are expressly denied.                                            */         
  9276.  /*                                                                  */         
  9277.  /* Provided this copyright notice is included, this software may    */         
  9278.  /* be freely distributed and not offered for sale.                  */         
  9279.  /*                                                                  */         
  9280.  /* Changes or modifications may be made and used only by the maker  */         
  9281.  /* of same, and not further distributed.  Such modifications should */         
  9282.  /* be mailed to the author for consideration for addition to the    */         
  9283.  /* software and incorporation in subsequent releases.               */         
  9284.  /*                                                                  */         
  9285.  /********************************************************************/         
  9286.                                                                                 
  9287. /* --------------------- "gg.h" include member --------------------- */         
  9288.                                                                                 
  9289. #pragma linkage(GGMbrifr,FORTRAN)                                               
  9290. #pragma linkage(GGMbrifc,FORTRAN)                                               
  9291. #pragma linkage(ispexec,OS)                                                     
  9292. #pragma linkage(isplink,OS)                                                     
  9293. #pragma linkage(ikjeff18,OS)                                                    
  9294.                                                                                 
  9295. /****** Installation-customized defines. *****************************/         
  9296.                                                                                 
  9297. #include "gguser.h"                                                             
  9298.                                                                                 
  9299. #ifndef  C370V1                                                                 
  9300. #ifndef  C370V2                                                                 
  9301. #ifndef  SASC                                                                   
  9302.  install_error_neither_C370V1_C370V2_nor_SASC_was_defined;                      
  9303. #endif                                                                          
  9304. #endif                                                                          
  9305. #endif                                                                          
  9306.                                                                                 
  9307. #ifndef  TCPIPV1                                                                
  9308. #ifndef  TCPIPV2                                                                
  9309. #ifndef  SNSTCPIP                                                               
  9310.  install_error_neither_TCPIPV1_TCPIPV2_nor_SNSTCPIP_was_defined;                
  9311. #endif                                                                          
  9312. #endif                                                                          
  9313. #endif                                                                          
  9314.                                                                                 
  9315. #define  MVS                                                                    
  9316.                                                                                 
  9317. /****** Clean up compiler warnings BEFORE time.h gets 'em ************/         
  9318.                                                                                 
  9319. #ifndef  SASC                                                                   
  9320. #define  localtime            LOCALTIM                                          
  9321. #endif                                                                          
  9322.                                                                                 
  9323. /****** Include all header files that are necessary. *****************/         
  9324.                                                                                 
  9325. #ifndef SNSTCPIP                                                                
  9326. #include <manifest.h>                                                           
  9327. #include <sys/types.h>                                                          
  9328. #include <netinet/in.h>                                                         
  9329. #include <sys/ioctl.h>                                                          
  9330. #include <tcperrno.h>                                                           
  9331. #include <fcntl.h>                                                              
  9332. #endif                                                                          
  9333.                                                                                 
  9334. #include <sys/socket.h>                                                         
  9335. #include <netdb.h>                                                              
  9336. #include <sys/uio.h>                                                            
  9337. #include <ctype.h>                                                              
  9338. #include <errno.h>                                                              
  9339. #include <limits.h>                                                             
  9340. #include <setjmp.h>                                                             
  9341. #include <stdio.h>                                                              
  9342. #include <stdarg.h>                                                             
  9343. #include <stdlib.h>                                                             
  9344. #include <string.h>                                                             
  9345. #include <stddef.h>                                                             
  9346. #include <time.h>                                                               
  9347.                                                                                 
  9348. #ifdef SNSTCPIP                                                                 
  9349. #include <acs.h>                                                                
  9350. #include <inet.h>                                                               
  9351. #include <sockcfg.h>                                                            
  9352. #include <serrno.h>                                                             
  9353. #endif                                                                          
  9354.                                                                                 
  9355. #ifndef  SASC                                                                   
  9356. #include <ctest.h>                                                              
  9357. #endif                                                                          
  9358.                                                                                 
  9359. #ifdef   SASC                                                                   
  9360. #include "ggsasc.h"                                                             
  9361. #endif                                                                          
  9362.                                                                                 
  9363. #undef ENOMEM                                                                   
  9364.                                                                                 
  9365. #include <mtf.h>                                                                
  9366.                                                                                 
  9367. /****** Version-dependent stuff **************************************/         
  9368.                                                                                 
  9369. #ifdef   C370V1                                                                 
  9370. #undef   FETCH                                                                  
  9371. #endif                                                                          
  9372.                                                                                 
  9373. #ifdef   C370V2                                                                 
  9374. #define  FETCH                                                                  
  9375. #endif                                                                          
  9376.                                                                                 
  9377. #ifdef   TCPIPV1                                                                
  9378. #define  TCP_DEBUG            tcp_debug                                         
  9379. #endif                                                                          
  9380.                                                                                 
  9381. #ifdef   TCPIPV2                                                                
  9382. #define  TCP_DEBUG            sock_debug                                        
  9383. #endif                                                                          
  9384.                                                                                 
  9385. #ifdef   SNSTCPIP                                                               
  9386. #define  TCP_DEBUG            /* I don't know how to debug in SNS */            
  9387. #undef   DEBUG                                                                  
  9388. #endif                                                                          
  9389.                                                                                 
  9390. #ifdef   DEBUG                                                                  
  9391. #define  TCP_DEBUG_ON         TCP_DEBUG(1)                                      
  9392. #define  TCP_DEBUG_OFF        TCP_DEBUG(0)                                      
  9393. #else                                                                           
  9394. #define  TCP_DEBUG_ON         /* */                                             
  9395. #define  TCP_DEBUG_OFF        /* */                                             
  9396. #endif                                                                          
  9397.                                                                                 
  9398. /****** Preprocessor bookkeeping *************************************/         
  9399.                                                                                 
  9400. #define  Bool                 char                                              
  9401. #define  Fool                 unsigned int /* for function arguments */         
  9402. #ifndef  TRUE                                                                   
  9403. #define  TRUE                 1                                                 
  9404. #endif                                                                          
  9405. #ifndef  FALSE                                                                  
  9406. #define  FALSE                0                                                 
  9407. #endif                                                                          
  9408.                                                                                 
  9409. #define  COMMANDSIZE          12                                                
  9410.                                                                                 
  9411. #define  GOPHER_FILE          '0'                                               
  9412. #define  GOPHER_DIRECTORY     '1'                                               
  9413. #define  GOPHER_CSO           '2'                                               
  9414. #define  GOPHER_ERROR         '3'                                               
  9415. #define  GOPHER_MAC_BINHEX    '4'                                               
  9416. #define  GOPHER_DOS_BINARCH   '5'                                               
  9417. #define  GOPHER_UUENCODE      '6'                                               
  9418. #define  GOPHER_WAIS          '7'                                               
  9419. #define  GOPHER_TELNET        '8'                                               
  9420. #define  GOPHER_TN3270        'T'                                               
  9421. #define  GOPHER_BINARY        '9'                                               
  9422. #define  GOPHER_REDUNDANT     '+'                                               
  9423. #define  GOPHER_WHOIS         'w'                                               
  9424.                                                                                 
  9425. #define  READ_BYTES           1024                                              
  9426. #define  SERVER_BUF_MSGSIZE   1024                                              
  9427. #define  CLIENT_BUF_MSGSIZE   1024                                              
  9428. #define  TEXT_BYTES           1024                                              
  9429. #define  INTERNET_SIZE        256                                               
  9430. #define  RBUFSIZE             256                                               
  9431. #define  OUTBUFSIZE           1024                                              
  9432.                                                                                 
  9433. #define  GOPHER_PORT_NUMBER   70                                                
  9434. #define  GOPHER_HOST_LENGTH   MAXHOSTNAMELEN                                    
  9435. #define  GOPHER_PATH_LENGTH   512                                               
  9436. #define  GOPHER_DESC_LENGTH   256                                               
  9437.                                                                                 
  9438. #define  SOCKET_GETCHAR_ERROR (-1)                                              
  9439. #define  SOCKET_NO_MORE       (-2)                                              
  9440. #define  SOCKET_READ_NOTHING  (-3)                                              
  9441.                                                                                 
  9442. #define  NO_VALUE             (-1)                                              
  9443.                                                                                 
  9444. #define  Rstruc               register struct                                   
  9445.                                                                                 
  9446. #define  EQUAL                !strcmp                                           
  9447. #define  UNEQUAL              strcmp                                            
  9448.                                                                                 
  9449. #define  CARRIAGE_RETURN      ('\r')                                            
  9450.                                                                                 
  9451. #ifdef   MVS                                                                    
  9452. #ifdef   I370                                                                   
  9453. #define  LINE_FEED            (0x15)                                            
  9454. #else                                                                           
  9455. #define  LINE_FEED            (0x25)                                            
  9456. #endif                                                                          
  9457. #else                                                                           
  9458. #define  LINE_FEED            (0x0a)                                            
  9459. #endif                                                                          
  9460.                                                                                 
  9461. #ifdef   MVS                                                                    
  9462. #ifdef   SNSTCPIP                                                               
  9463. #define  EtoA                 etoa                                              
  9464. #define  AtoE                 atoe                                              
  9465. #else                                                                           
  9466. #ifdef   I370                                                                   
  9467. #define  EtoA                 htoncs                                            
  9468. #define  AtoE                 ntohcs                                            
  9469. #else                                                                           
  9470. #define  EtoA(x)              ebcdictoascii[x]                                  
  9471. #define  AtoE(x)              asciitoebcdic[x]                                  
  9472. #define  ebcdictoascii        ebcdicto                                          
  9473. #define  asciitoebcdic        asciitoe                                          
  9474. #endif                                                                          
  9475. #endif                                                                          
  9476. #endif                                                                          
  9477.                                                                                 
  9478. #ifdef SNSTCPIP                                                                 
  9479. #define EBCDIC_TO_ASCII(A,B) EtoA(A,B)                                          
  9480. #define ASCII_TO_EBCDIC(A,B) AtoE(A,B)                                          
  9481. #else                                                                           
  9482. #define EBCDIC_TO_ASCII(A,B) {int _i; \                                         
  9483.                               for (_i=0; _i<(B); ++_i) \                        
  9484.                                   (A)[_i] = EtoA((A)[_i]); \                    
  9485.                              }                                                  
  9486. #define ASCII_TO_EBCDIC(A,B) {int _i; \                                         
  9487.                               for (_i=0; _i<(B); ++_i) \                        
  9488.                                   (A)[_i] = AtoE((A)[_i]); \                    
  9489.                              }                                                  
  9490. #endif                                                                          
  9491.                                                                                 
  9492. #ifdef TCPIPV1                                                                  
  9493. #define REPORT_TCP_ERROR(A)  /* */                                              
  9494. #endif                                                                          
  9495.                                                                                 
  9496. #ifdef TCPIPV2                                                                  
  9497. #define REPORT_TCP_ERROR(A)  tcperror(A)                                        
  9498. #endif                                                                          
  9499.                                                                                 
  9500. #ifdef SNSTCPIP                                                                 
  9501. #define REPORT_TCP_ERROR(A)  fprintf(stderr,\                                   
  9502.                                     "\nTCP error on %s: errno = %d\n",\         
  9503.                                     A,GET_ERRNO)                                
  9504. #endif                                                                          
  9505.                                                                                 
  9506. #ifdef SNSTCPIP                                                                 
  9507. #define Accept(A,B,C)        accept((A),(struct sockaddr *)(B),(C))             
  9508. #define Bind(A,B,C)          bind((A),(struct sockaddr *)(B),(C))               
  9509. #define Connect(A,B,C)       connect((A),(struct sockaddr *)(B),(C))            
  9510. #define Gethostbyaddr(A,B,C) gethostbyaddr((char *)(A),(B),(C))                 
  9511. #define Getpeername(A,B,C)   getpeername((A),(struct sockaddr *)(B),(C))        
  9512. #define Getsockopt(A,B,C,D,E) getsockopt((A),(B),(C),(char *)(D),(E))           
  9513. #define EWOULDBLOCK          (ESWOULDBLOCK+s0skcfg.errnobase)                   
  9514. #else                                                                           
  9515. #define Accept               accept                                             
  9516. #define Bind                 bind                                               
  9517. #define Connect              connect                                            
  9518. #define Gethostbyaddr        gethostbyaddr                                      
  9519. #define Getpeername          getpeername                                        
  9520. #define Getsockopt           getsockopt                                         
  9521. #endif                                                                          
  9522.                                                                                 
  9523. #ifdef   FETCH                                                                  
  9524. #define  ISPLINK              (gp->isplink_pointer)                             
  9525. #define  ISPEXEC              (gp->ispexec_pointer)                             
  9526. #else                                                                           
  9527. #define  ISPLINK              isplink                                           
  9528. #define  ISPEXEC              ispexec                                           
  9529. #endif                                                                          
  9530.                                                                                 
  9531. #define  DATAOUT_LOW          0x01                                              
  9532. #define  DATAOUT_HIGH         0x02                                              
  9533. #define  DATAIN_LOW           0x03                                              
  9534. #define  DATAIN_HIGH          0x04                                              
  9535. #define  DATAOUT_BLUE         DATAOUT_LOW                                       
  9536. #define  DATAOUT_GREEN        0x05                                              
  9537. #define  DATAOUT_PINK         0x06                                              
  9538. #define  DATAOUT_RED          0x07                                              
  9539. #define  DATAOUT_TURQ         0x08                                              
  9540. #define  DATAOUT_WHITE        DATAOUT_HIGH                                      
  9541. #define  DATAOUT_YELLOW       0x09                                              
  9542. #define  DATAIN_BLUE          0x0a                                              
  9543. #define  DATAIN_GREEN         DATAIN_LOW                                        
  9544. #define  DATAIN_PINK          0x0b                                              
  9545. #define  DATAIN_RED           DATAIN_HIGH                                       
  9546. #define  DATAIN_TURQ          0x0c                                              
  9547. #define  DATAIN_WHITE         0x0d                                              
  9548. #define  DATAIN_YELLOW        0x0e                                              
  9549.                                                                                 
  9550. #define  S99VRBAL  0x01             /* ALLOCATION                    */         
  9551. #define  S99VRBUN  0x02             /* UNALLOCATION                  */         
  9552. #define  S99VRBCC  0x03             /* CONCATENATION                 */         
  9553. #define  S99VRBDC  0x04             /* DECONCATENATION               */         
  9554. #define  S99VRBRI  0x05             /* REMOVE IN-USE                 */         
  9555. #define  S99VRBDN  0x06             /* DDNAME ALLOCATION             */         
  9556. #define  S99VRBIN  0x07             /* INFORMATION RETRIEVAL         */         
  9557. #define  S99NOCNV  0x40             /* ALLOC FUNCTION-DO NOT USE AN  */         
  9558.                                     /* EXISTING ALLOCATION TO SATISFY*/         
  9559.                                     /* THE REQUEST                   */         
  9560. #define  DALDDNAM   0x0001          /* DDNAME                        */         
  9561. #define  DALDSNAM   0x0002          /* DSNAME                        */         
  9562. #define  DALMEMBR   0x0003          /* MEMBER NAME                   */         
  9563. #define  DALSTATS   0x0004          /* DATA SET STATUS               */         
  9564. #define  DALNDISP   0x0005          /* DATA SET DISPOSITION          */         
  9565. #define  DALBLKLN   0x0009          /* BLOCK LENGTH                  */         
  9566. #define  DALPRIME   0x000a          /* PRIMARY SPACE ALLOCATION      */         
  9567. #define  DALSECND   0x000b          /* SECONDARY SPACE ALLOCATION    */         
  9568. #define  DALDIR     0x000c          /* DIRECTORY BLOCK ALLOCATION    */         
  9569. #define  DALBLKSZ   0x0030          /* DCB BLOCKSIZE                 */         
  9570. #define  DALDSORG   0x003c          /* DATA SET ORGANIZATION         */         
  9571. #define  DALLRECL   0x0042          /* DCB LOGICAL RECORD LENGTH     */         
  9572. #define  DALRECFM   0x0049          /* DCB RECORD FORMAT             */         
  9573. #define  DALPERMA   0x0052          /* PERMANENTLY ALLOCATED ATTRIB  */         
  9574. #define  DALRTDDN   0x0055          /* RETURN DDNAME                 */         
  9575. #define  DALRTDSN   0x0056          /* RETURN DSNAME                 */         
  9576. #define  DALRTORG   0x0057          /* RETURN D.S. ORGANIZATION      */         
  9577. #define  DUNDDNAM   0x0001          /* DDNAME                        */         
  9578. #define  DUNDSNAM   0x0002          /* DSNAME                        */         
  9579. #define  DUNUNALC   0x0007          /* UNALLOC OPTION                */         
  9580.                                                                                 
  9581. #define  SHR        0x08                                                        
  9582. #define  NEW        0x04                                                        
  9583. #define  MOD        0x02                                                        
  9584. #define  OLD        0x01                                                        
  9585. #define  KEEP       0x08                                                        
  9586. #define  DELETE     0x04                                                        
  9587. #define  CATLG      0x02                                                        
  9588. #define  UNCATLG    0x01                                                        
  9589. #define  RECFM_F    0x80                                                        
  9590. #define  RECFM_V    0x40                                                        
  9591. #define  RECFM_U    0xc0                                                        
  9592. #define  RECFM_D    0x20                                                        
  9593. #define  RECFM_T    0x20                                                        
  9594. #define  RECFM_B    0x10                                                        
  9595. #define  RECFM_S    0x08                                                        
  9596. #define  RECFM_A    0x04                                                        
  9597. #define  RECFM_M    0x02                                                        
  9598. #define  RECFM_FB   (RECFM_F | RECFM_B)                                         
  9599. #define  RECFM_VB   (RECFM_V | RECFM_B)                                         
  9600. #define  DSORG_PS   0x4000                                                      
  9601. #define  DSORG_PO   0x0200                                                      
  9602.                                                                                 
  9603.                                                                                 
  9604. /****** Data and structure definitions. ******************************/         
  9605.                                                                                 
  9606. typedef struct _textunit     TEXTUNIT;                                          
  9607. typedef unsigned int         IPADDRESS;                                         
  9608. typedef char                 gophertype;                                        
  9609.                                                                                 
  9610. enum socket_retval  {                                                           
  9611.                      SERVER_READ_OK,                                            
  9612.                      SERVER_READ_ERROR,                                         
  9613.                      SERVER_BUFFER_ERROR,                                       
  9614.                      SERVER_NO_MORE,                                            
  9615.                      SERVER_READ_NOTHING                                        
  9616.                     };                                                          
  9617.                                                                                 
  9618. enum data_set_type  {                                                           
  9619.                      PDS,                                                       
  9620.                      SEQ,                                                       
  9621.                      UNK                                                        
  9622.                     };                                                          
  9623.                                                                                 
  9624. enum user_option    {                                                           
  9625.                      OPTION_ALL,                                                
  9626.                      OPTION_VIEW,                                               
  9627.                      OPTION_OTHER                                               
  9628.                     };                                                          
  9629.                                                                                 
  9630. struct textline    {                                                            
  9631.                     struct textline    *next;                                   
  9632.                     short               text_length;                            
  9633.                     short               tab_expanded_text_length;               
  9634.                     char               *tab_expanded_text;                      
  9635.                     char                text[1];  /* dummy */                   
  9636.                    };                                                           
  9637.                                                                                 
  9638. struct texthdr     {                                                            
  9639.                     int                   text_line_count;                      
  9640.                     struct textline      *text_body_line;                       
  9641.                     short                 text_max_length;                      
  9642.                     short                 text_max_tab_expanded_length;         
  9643.                     struct textline      *first_text_line;                      
  9644.                     struct textline      *current_text_line;                    
  9645.                     struct textline      *last_text_line;                       
  9646.                    };                                                           
  9647.                                                                                 
  9648. struct cmddesc   {                                                              
  9649.                   char    command_name[COMMANDSIZE];                            
  9650.                   Bool    (*command_processor)();                               
  9651.                  };                                                             
  9652.                                                                                 
  9653. struct seldesc   {                                                              
  9654.                   char    selection_code;                                       
  9655.                   Bool    (*selection_processor)();                             
  9656.                  };                                                             
  9657.                                                                                 
  9658. struct tabledesc {                                                              
  9659.                   char   *command_variable;                                     
  9660.         struct cmddesc   *first_cmddesc;                                        
  9661.         struct seldesc   *first_seldesc;                                        
  9662.                  };                                                             
  9663.                                                                                 
  9664. struct _textunit {                                                              
  9665.                   unsigned short         key;                                   
  9666.                   unsigned short         num;                                   
  9667.                   struct {                                                      
  9668.                           unsigned short len;                                   
  9669.                           char           prm[80];                               
  9670.                          }               ent;                                   
  9671.                  };                                                             
  9672.                                                                                 
  9673. struct extraction {                                                             
  9674.                    int                   from_number;                           
  9675.                    int                   to_number;                             
  9676.                    int                   count;                                 
  9677.                    enum data_set_type    mode;                                  
  9678.                    Bool                  appending;                             
  9679.                    Bool                  blanking;                              
  9680.                    Bool                  tab_expanding;                         
  9681.                    char                  panelname     [9];                     
  9682.                    char                  dsname       [65];                     
  9683.                    char                  separator    [81];                     
  9684.                    char                  member_prefix [9];                     
  9685.                    char                  ddname        [9];                     
  9686.                   };                                                            
  9687.                                                                                 
  9688. struct gopherinfo {                                                             
  9689.                    gophertype            type;                                  
  9690.                    int                   port;                                  
  9691.                    struct texthdr        thdr;                                  
  9692.                    char                  path [GOPHER_PATH_LENGTH+1];           
  9693.                    char                  host [GOPHER_HOST_LENGTH+1];           
  9694.                    char                  desc [GOPHER_DESC_LENGTH+1];           
  9695.                   };                                                            
  9696.                                                                                 
  9697. struct recvstruct {                                                             
  9698.     int             sockfd;   /* socket descriptor for socket call */           
  9699.     int             outlen;                                                     
  9700.     FILE           *outfp;    /* used by local (non-socket) interface*/         
  9701.     char           *fileptr;                                                    
  9702.     char           *wargptr;                                                    
  9703.     FILE           *readfile;                 /* declare the file... */         
  9704.     struct hostent  clienthostent;                                              
  9705.     char            myname  [MAXHOSTNAMELEN+1];                                 
  9706.     char            hostname[MAXHOSTNAMELEN+1];  /* client host name */         
  9707.     char            hosttest[MAXHOSTNAMELEN+1];  /* client host name */         
  9708.     char            buffer  [RBUFSIZE]; /* client's character string */         
  9709.     char            dsname  [RBUFSIZE];                                         
  9710.     char            sockbuf [OUTBUFSIZE];    /* socket output buffer */         
  9711.    };                                                                           
  9712.                                                                                 
  9713. struct menuitem {                                                               
  9714.     char          type;                  /* type of record to send   */         
  9715.     char          desc     [GOPHER_DESC_LENGTH+1];                              
  9716.     char          select   [GOPHER_PATH_LENGTH+1];                              
  9717.     char          hostname [GOPHER_HOST_LENGTH+1];                              
  9718.     int           port;                  /* host port to connect to  */         
  9719.    };                                                                           
  9720.                                                                                 
  9721. struct ggcb {                                                                   
  9722.              char    *server_buf;                                               
  9723.              char    *client_buf;                                               
  9724.              char    *gopher_command;                                           
  9725.   struct recvstruct  *recvp;                                                    
  9726.              char    *extract_separator_line;                                   
  9727. #ifdef FETCH                                                                    
  9728.               int   (*isplink_pointer)();                                       
  9729.               int   (*ispexec_pointer)();                                       
  9730. #endif                                                                          
  9731.               int     ispfrc;                                                   
  9732.               int     socknum;                                                  
  9733.               int     g_bytes_returned;                                         
  9734.               int     g_buf_index;                                              
  9735.               int     brif_previous_recno;                                      
  9736.              FILE    *debug_file;                                               
  9737.              FILE    *extract_file;                                             
  9738.    struct texthdr    *brifp;                                                    
  9739.    struct texthdr     thdr;                                                     
  9740.    struct gopherinfo *ginfo;                                                    
  9741.              Bool     test_mode;                                                
  9742.              Bool     debug_mode;                                               
  9743.              Bool     quit;                                                     
  9744.              Bool     time_to_go_home;                                          
  9745.              Bool     server_has_something_pending;                             
  9746.              Bool     server_finished_replying;                                 
  9747.              Bool     sending_text;                                             
  9748.              Bool     receiving_text;                                           
  9749.              Bool     local_mode;                                               
  9750.              Bool     dont_read;                                                
  9751.              Bool     connected_to_server;                                      
  9752.              Bool     connection_broken;                                        
  9753.              Bool     closing_connection;                                       
  9754.              Bool     reconnect_in_progress;                                    
  9755.              Bool     extract_tab_expanding;                                    
  9756.              Bool     extract_appending;                                        
  9757.              Bool     extract_blank_before_separator;                           
  9758.              Bool     extract_write_error;                                      
  9759.              Bool     extract_close_error;                                      
  9760.              Bool     warn_overwrite;                                           
  9761.              Bool     warn_append;                                              
  9762.              Bool     setmsg;                                                   
  9763.              Bool     autoscroll;                                               
  9764.         IPADDRESS     client_ip_address;                                        
  9765.         IPADDRESS     server_ip_address;                                        
  9766.              char     ggserver            [MAXHOSTNAMELEN+1];                   
  9767.              char     ggclient            [MAXHOSTNAMELEN+1];                   
  9768.              char     client_hostname     [MAXHOSTNAMELEN+1];                   
  9769.              char     client_ip_addrstr   [16];                                 
  9770.              char     server_hostname     [MAXHOSTNAMELEN+1];                   
  9771.              char     server_ip_addrstr   [16];                                 
  9772.              char     g_buf               [READ_BYTES];                         
  9773.             };                                                                  
  9774.                                                                                 
  9775. #ifdef MVS                                                                      
  9776. #ifndef I370                                                                    
  9777. extern char                 ebcdictoascii[];                                    
  9778. extern char                 asciitoebcdic[];                                    
  9779. #endif                                                                          
  9780. #endif                                                                          
  9781.                                                                                 
  9782. #ifndef FETCH                                                                   
  9783. extern int                  isplink();                                          
  9784. extern int                  ispexec();                                          
  9785. #endif                                                                          
  9786.                                                                                 
  9787. #define  NOTIFY_MSG   1                                                         
  9788. #define  WARNING_MSG  2                                                         
  9789. #define  CRITICAL_MSG 3                                                         
  9790.                                                                                 
  9791. #define  WARN1(X)           GGMpmsg(gp,NOTIFY_MSG,NULL,X)                       
  9792. #define  WARN2(X,Y)         GGMpmsg(gp,NOTIFY_MSG,NULL,X,Y)                     
  9793. #define  WARN3(X,Y,Z)       GGMpmsg(gp,NOTIFY_MSG,NULL,X,Y,Z)                   
  9794. #define  WARN4(X,Y,Z,W)     GGMpmsg(gp,NOTIFY_MSG,NULL,X,Y,Z,W)                 
  9795. #define  ERR1(X)            GGMpmsg(gp,WARNING_MSG,NULL,X)                      
  9796. #define  ERR2(X,Y)          GGMpmsg(gp,WARNING_MSG,NULL,X,Y)                    
  9797. #define  ERR3(X,Y,Z)        GGMpmsg(gp,WARNING_MSG,NULL,X,Y,Z)                  
  9798. #define  ERR4(X,Y,Z,W)      GGMpmsg(gp,WARNING_MSG,NULL,X,Y,Z,W)                
  9799. #define  CRIT1(X)           GGMpmsg(gp,CRITICAL_MSG,NULL,X)                     
  9800. #define  CRIT2(X,Y)         GGMpmsg(gp,CRITICAL_MSG,NULL,X,Y)                   
  9801. #define  CRIT3(X,Y,Z)       GGMpmsg(gp,CRITICAL_MSG,NULL,X,Y,Z)                 
  9802.                                                                                 
  9803. #define  GETMAIN(Ptr,Typ,Siz,For) \                                             
  9804.          GGMgetm(gp,(char **)&(Ptr),(sizeof(Typ))*(Siz),For)                    
  9805.                                                                                 
  9806. #define  FREEMAIN(Ptr,For)    if (Ptr) {GGMfreem(gp,(char *)Ptr,For);}          
  9807.                                                                                 
  9808. #ifndef I370                                                                    
  9809.                                                                                 
  9810. #define  OPEN_TEXT_FILE_FOR_WRITE(F)  \                                         
  9811.          fopen((F),"w,recfm=vb,lrecl=259,blksize=6233")                         
  9812.                                                                                 
  9813. #define  OPEN_TEXT_FILE_FOR_APPEND(F)  \                                        
  9814.          fopen((F),"a,recfm=vb,lrecl=259,blksize=6233")                         
  9815.                                                                                 
  9816. #define  OPEN_TEXT_FILE_FOR_WRITE_OR_APPEND(F,B)  \                             
  9817.          fopen((F),(B) ? "a,recfm=vb,lrecl=259,blksize=6233"  \                 
  9818.                        : "w,recfm=vb,lrecl=259,blksize=6233")                   
  9819.                                                                                 
  9820. #else                                                                           
  9821.                                                                                 
  9822. #define  OPEN_TEXT_FILE_FOR_WRITE(F)  \                                         
  9823.          afopen((F),"w","seq","recfm=v,lrecl=255,blksize=6233")                 
  9824.                                                                                 
  9825. #define  OPEN_TEXT_FILE_FOR_APPEND(F)  \                                        
  9826.          afopen((F),"a","seq","recfm=v,lrecl=255,blksize=6233")                 
  9827.                                                                                 
  9828. #define  OPEN_TEXT_FILE_FOR_WRITE_OR_APPEND(F,B)  \                             
  9829.          afopen((F),(B)?"a":"w","seq","recfm=v,lrecl=255,blksize=6233")         
  9830.                                                                                 
  9831. #endif                                                                          
  9832.                                                                                 
  9833. #define ebdtoasc(C) {char *__cp;\                                               
  9834.                      for(__cp = C;*__cp;__cp++) *__cp = EtoA(*__cp);}           
  9835.                                                                                 
  9836. #define asctoebd(C) {char *__cp;\                                               
  9837.                      for(__cp = C;*__cp;__cp++) *__cp = AtoE(*__cp);}           
  9838.                                                                                 
  9839. #define uppercase_in_place(C) {char *__cp;\                                     
  9840.                      for(__cp=C;*__cp;__cp++) *__cp = toupper(*__cp);}          
  9841.                                                                                 
  9842. #define lowercase_in_place(C) {char *__cp;\                                     
  9843.                      for(__cp=C;*__cp;__cp++) *__cp = tolower(*__cp);}          
  9844.                                                                                 
  9845.                                                                                 
  9846. /****** Procedure and function declarations. *************************/         
  9847.                                                                                 
  9848. extern enum data_set_type  GGMalloc(char *, char *, enum data_set_type,         
  9849.                                                                   int);         
  9850. extern int                 GGMbrifr(char **, int *, int *, void *);             
  9851. extern int                 GGMbrifc(int *, void *);                             
  9852. extern void                GGMbtext(struct ggcb *, struct texthdr *,            
  9853.                                                                FILE *);         
  9854. extern void                GGMclrtx(struct ggcb *,struct gopherinfo *);         
  9855. extern Bool                GGMconn (struct ggcb *);                             
  9856. extern char               *GGMcopy (struct ggcb *, char *);                     
  9857. extern Bool                GGMcso  (struct ggcb *,struct gopherinfo *,          
  9858.                                                                  Fool);         
  9859. extern void                GGMdfail(int,__S99parms *);                          
  9860. extern Bool                GGMdir  (struct ggcb *,struct gopherinfo *,          
  9861.                                                                  Fool);         
  9862. extern void                GGMdisc (struct ggcb *);                             
  9863. extern int                 GGMdispl(struct ggcb *, char *);                     
  9864. extern void                GGMdump (struct ggcb *,char *, char *, int);         
  9865. extern void                GGMesrvr(struct ggcb *);                             
  9866. extern void                GGMfreem(struct ggcb *,char *,char *);               
  9867. extern FILE               *GGMgetds(struct ggcb *,struct extraction *);         
  9868. extern void                GGMgetm (struct ggcb *,char **,int,char *);          
  9869. extern Bool                GGMgofor(struct ggcb *,struct gopherinfo *,          
  9870.                                                                 Fool);          
  9871. extern Bool                GGMgsrvl(struct ggcb *, char **, Fool);              
  9872. extern void                GGMierr (struct ggcb *);                             
  9873. extern int                 GGMiget (struct ggcb *, char *);                     
  9874. extern void                GGMimsg (struct ggcb *, char *);                     
  9875. extern Bool                GGMispf (struct ggcb *, char *);                     
  9876. extern Bool                GGMivget(struct ggcb *, char *, char *,int);         
  9877. extern Bool                GGMivput(struct ggcb *, char *, char *,int);         
  9878. extern void                GGMmtfer(int, char*);                                
  9879. extern struct textline    *GGMouttx(struct ggcb *, char *,                      
  9880.                                                   struct gopherinfo *);         
  9881. extern Bool                GGMouts (struct recvstruct *, char *);               
  9882. extern Bool                GGMproc (struct recvstruct *);                       
  9883. extern void                GGMrbfm (struct ggcb *);                             
  9884. extern void                GGMrperr(struct ggcb *);                             
  9885. extern Bool                GGMsockt(struct ggcb *);                             
  9886. extern void                GGMsopt (struct ggcb *,enum user_option);            
  9887. extern char               *GGMstrlc(char *, char *);                            
  9888. extern Bool                GGMtnet (struct ggcb *,struct gopherinfo *,          
  9889.                                                                  Fool);         
  9890. extern int                 GGMtso  (char *);                                    
  9891. extern char               *GGMtype (gophertype);                                
  9892. extern Bool                GGMunalc(char *);                                    
  9893. extern Bool                GGMvtx  (struct ggcb *,struct gopherinfo *,          
  9894.                                                                  Fool);         
  9895. extern Bool                GGMwais (struct ggcb *,struct gopherinfo *,          
  9896.                                                                  Fool);         
  9897. extern Bool                GGMwhois(struct ggcb *,struct gopherinfo *,          
  9898.                                                                  Fool);         
  9899. extern Bool                GGMxlist(struct ggcb *,char *);                      
  9900. extern Bool                GGMxtx  (struct ggcb *,struct gopherinfo *);         
  9901.                                                                                 
  9902. #ifndef SUPPRESS_V_DECLARATION                                                  
  9903. extern void                GGMpmsg (struct ggcb *,int,char *,char *,            
  9904.                                                                   ...);         
  9905. #endif                                                                          
  9906.                                                                                 
  9907. ./   ADD NAME=GGSASC,SSI=01000043                                               
  9908.                                                                                 
  9909.  /********************************************************************/         
  9910.  /*                                                                  */         
  9911.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  9912.  /*                                                                  */         
  9913.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  9914.  /*                                                                  */         
  9915.  /* SAS modifications due to Dale Ingold at SAS Institute, Inc.      */         
  9916.  /*                                                                  */         
  9917.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  9918.  /* including the implied warranties of merchantability and fitness, */         
  9919.  /* are expressly denied.                                            */         
  9920.  /*                                                                  */         
  9921.  /* Provided this copyright notice is included, this software may    */         
  9922.  /* be freely distributed and not offered for sale.                  */         
  9923.  /*                                                                  */         
  9924.  /* Changes or modifications may be made and used only by the maker  */         
  9925.  /* of same, and not further distributed.  Such modifications should */         
  9926.  /* be mailed to the author for consideration for addition to the    */         
  9927.  /* software and incorporation in subsequent releases.               */         
  9928.  /*                                                                  */         
  9929.  /********************************************************************/         
  9930.                                                                                 
  9931. /* ------------------- "ggsasc.h" include member ------------------- */         
  9932.                                                                                 
  9933. #ifdef SASC                                                                     
  9934.                                                                                 
  9935. #define I370                                                                    
  9936.                                                                                 
  9937. #include <dynam.h>                                                              
  9938.                                                                                 
  9939. #define FETCH                                                                   
  9940.                                                                                 
  9941.  __inline void (*fetch( const char *modname ))()                                
  9942.  {                                                                              
  9943.    void (*fpp)();                                                               
  9944.                                                                                 
  9945.    loadm( modname, &fpp );                                                      
  9946.    return( fpp );                                                               
  9947.  }                                                                              
  9948.                                                                                 
  9949.  __inline int (*release( void (*fpp)() ))                                       
  9950.  {                                                                              
  9951.    unloadm( fpp );                                                              
  9952.    return( 0 );                                                                 
  9953.  }                                                                              
  9954.                                                                                 
  9955.                                                                                 
  9956. #ifndef __SVC99                                                                 
  9957.                                                                                 
  9958.   #define __SVC99  1                                                            
  9959.                                                                                 
  9960.   #include <code.h>                                                             
  9961.                                                                                 
  9962.   struct __S99struc                                                             
  9963.     {                                                                           
  9964.       unsigned char   __S99RBLN;  /* length of request block..20      */        
  9965.       unsigned char   __S99VERB;  /* verb code                        */        
  9966.       unsigned short  __S99FLAG1; /* FLAGS1 field of SVC99 Req Block  */        
  9967.       unsigned short  __S99ERROR; /* error code field                 */        
  9968.       unsigned short  __S99INFO;  /* information reason code          */        
  9969.       void           *__S99TXTPP; /* address of text unit pointer list*/        
  9970.       int             __reserved; /* reserved..will always be 0       */        
  9971.       unsigned int    __S99FLAG2; /* FLAGS2 field..can only be filled */        
  9972.                                   /* in by APF authorized programs    */        
  9973.     };                                                                          
  9974.                                                                                 
  9975.   typedef struct __S99struc __S99parms;                                         
  9976.                                                                                 
  9977.   __inline int svc99(__S99parms* svc99parmlist)                                 
  9978.     { return( (_ldregs(R1, &svc99parmlist),                                     
  9979.                _code(0, 0x0a63),                                                
  9980.                _stregs(R15) ) );                                                
  9981.     }                                                                           
  9982.                                                                                 
  9983. #endif                                                                          
  9984.                                                                                 
  9985. #define FALSE 0                                                                 
  9986. #define TRUE  1                                                                 
  9987.                                                                                 
  9988. #include <lcio.h>                                                               
  9989.                                                                                 
  9990. #define  MAXHOSTNAMELEN     64                                                  
  9991.                                                                                 
  9992. #define  __ctest(X)  fprintf(stderr,\                                           
  9993.                      "GGMVS: CTEST is not supported by this compiler.")         
  9994.                                                                                 
  9995. #endif                                                                          
  9996.                                                                                 
  9997. ./   ADD NAME=GGUSER,SSI=01180036                                               
  9998.                                                                                 
  9999.  /********************************************************************/         
  10000.  /*                                                                  */         
  10001.  /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992    */         
  10002.  /*                                                                  */         
  10003.  /* GOPHER server due to Shawn Hart at the University of Delaware.   */         
  10004.  /*                                                                  */         
  10005.  /* This software is provided on an "AS IS" basis.  All warranties,  */         
  10006.  /* including the implied warranties of merchantability and fitness, */         
  10007.  /* are expressly denied.                                            */         
  10008.  /*                                                                  */         
  10009.  /* Provided this copyright notice is included, this software may    */         
  10010.  /* be freely distributed and not offered for sale.                  */         
  10011.  /*                                                                  */         
  10012.  /* Changes or modifications may be made and used only by the maker  */         
  10013.  /* of same, and not further distributed.  Such modifications should */         
  10014.  /* be mailed to the author for consideration for addition to the    */         
  10015.  /* software and incorporation in subsequent releases.               */         
  10016.  /*                                                                  */         
  10017.  /********************************************************************/         
  10018.                                                                                 
  10019. /* ------------------- "gguser.h" include member ------------------- */         
  10020.                                                                                 
  10021. /* Include file for locally customized values. */                               
  10022.                                                                                 
  10023. /* Define levels of C/370 and TCP/IP.  This controls support for                
  10024.  * fetching of non-C load modules and socket error reporting.                   
  10025.  */                                                                             
  10026.                                                                                 
  10027. /* #define  C370V1    /* define this if C/370 Version 1 */                      
  10028.    #define  C370V2    /* define this if C/370 Version 2 or higher */            
  10029. /* #define  SASC      /* define this if SAS/C compiler */                       
  10030.                                                                                 
  10031. /* #define  TCPIPV1   /* define this if TCP/IP Version 1 */                     
  10032.    #define  TCPIPV2   /* define this if TCP/IP Version 2 or higher */           
  10033. /* #define  SNSTCPIP  /* define this if SNS/TCPAccess    */                     
  10034.                                                                                 
  10035. /* Define the following defaults for your installation. */                      
  10036. /* Use XTELNET if you like the CSOCK package from UCLA. */                      
  10037.                                                                                 
  10038.    #define  TELNET_COMMAND_NAME     "TELNET"                                    
  10039. /* #define  TELNET_COMMAND_NAME     "XTELNET" */                                
  10040.                                                                                 
  10041. /* Define this if the server host name set by the "+" frob                      
  10042.  * should have the domain name appended.  Note that this will                   
  10043.  * affect how the hostname needs to be specified for a                          
  10044.  * Path=(pdsmember) specification - it must match the local host                
  10045.  * the way it is generated here.  Of course, host=+ will do it anyway.          
  10046.  */                                                                             
  10047.                                                                                 
  10048.    #define  APPEND_DOMAIN_NAME_TO_SELF                                          
  10049. /* #undef   APPEND_DOMAIN_NAME_TO_SELF */                                       
  10050.                                                                                 
  10051. /*                                                                              
  10052.  * Turn on for TCP-level debugging output (you probably don't want to           
  10053.  * unless your TCP/IP stuff is really broken and I can't help you).             
  10054.  */                                                                             
  10055.                                                                                 
  10056. /* #define DEBUG       */                                                       
  10057.    #undef  DEBUG                                                                
  10058.                                                                                 
  10059. /*                                                                              
  10060.  * Turn on for MTF-level debugging output.                                      
  10061.  */                                                                             
  10062.                                                                                 
  10063. /* #define DEBUGMTF    */                                                       
  10064.    #undef  DEBUGMTF                                                             
  10065.                                                                                 
  10066. /* Server and MTF stuff. */                                                     
  10067.                                                                                 
  10068. /* #define  MTF_TASKS           8 */                                            
  10069. #define  MTF_TASKS           1  /* lest REXX multitasking lossage */            
  10070. #define  TCP_QUEUE_LENGTH   20                                                  
  10071. #define  SERV_TCP_PORT      70                                                  
  10072. #define  CONNECT_TIME_OUT   60                                                  
  10073. #define  DEFAULT_DIRECTORY  "DD:GGGOPHER"                                       
  10074. #define  ACCESS_TABLE       "DD:GGACCESS"                                       
  10075. #define  MY_DOMAIN_SUFFIX   ".DRAPER.COM"                                       
  10076.                                                                                 
  10077. /* note: could get MY_DOMAIN_SUFFIX from TCPIP startup - what call? */          
  10078.                                                                                 
  10079. /* Client stuff. */                                                             
  10080.                                                                                 
  10081. #define  INITIAL_TYPE   GOPHER_DIRECTORY                                        
  10082. #define  INITIAL_PORT   GOPHER_PORT_NUMBER                                      
  10083. #define  INITIAL_PATH   ""                                                      
  10084. #define  INITIAL_HOST   "MVS.DRAPER.COM"                                        
  10085. #define  INITIAL_DESC   "Root"                                                  
  10086.                                                                                 
  10087. /* Server and client stuff. */                                                  
  10088.                                                                                 
  10089. #define  IDENT_HOST_FROB    "+"                                                 
  10090. #define  LOCAL_HOST_FROB    "-"                                                 
  10091.                                                                                 
  10092. /********************************************************************/          
  10093. /*  The following defines the module name for the MTF subtask.      */          
  10094. /********************************************************************/          
  10095.                                                                                 
  10096. #define GOPHER_PARALLEL_TASK "GGSTASK"                                          
  10097.                                                                                 
  10098. /********************************************************************/          
  10099. /*  following are "gopher" record types.   */                                   
  10100. /********************************************************************/          
  10101.                                                                                 
  10102. #define  GFILE    '0'                                                           
  10103. #define  MENU     '1'                                                           
  10104. #define  ERROR    '2'                                                           
  10105. #define  INDEX    '7'                                                           
  10106. #define  TELNET   '8'                                                           
  10107. #define  TN3270   'T'                                                           
  10108. #define  WHOIS    'w'                                                           
  10109.                                                                                 
  10110. /********************************************************************/          
  10111. /* following are MVS file type identifiers.  They must appear at the            
  10112.    beginning of the file they're identifying.                        */         
  10113. /********************************************************************/          
  10114.                                                                                 
  10115. #define  MENUIDENT    "GOPHER_MENU"                                             
  10116. #define  INDEXIDENT   "GOPHER_INDEX"                                            
  10117.                                                                                 
  10118. /********************************************************************/          
  10119. /*  following are tokens for menu GOPHER identifiers.    */                     
  10120. /********************************************************************/          
  10121.                                                                                 
  10122. #define  TOKTYPE      "TYPE"                                                    
  10123. #define  TYPETOK      0                                                         
  10124. #define  TOKNAME      "NAME"                                                    
  10125. #define  NAMETOK      1                                                         
  10126. #define  TOKPATH      "PATH"                                                    
  10127. #define  PATHTOK      2                                                         
  10128. #define  TOKHOST      "HOST"                                                    
  10129. #define  HOSTTOK      3                                                         
  10130. #define  TOKPORT      "PORT"                                                    
  10131. #define  PORTTOK      4                                                         
  10132. #define  TOKEND       "END"                                                     
  10133. #define  ENDTOK       5                                                         
  10134. #define  TOKCOMMENT   "*"                                                       
  10135. #define  COMMENTTOK   6                                                         
  10136.                                                                                 
  10137. #define  TOKDISPLAY   "DISPLAY"                                                 
  10138. #define  DISPLAYTOK   7                                                         
  10139. #define  TOKSELECT    "SELECTOR"                                                
  10140. #define  SELECTTOK    8                                                         
  10141.                                                                                 
  10142. /********************************************************************/          
  10143. /*  types of   "types" - operands of the TYPE keyword in directories.*/         
  10144. /********************************************************************/          
  10145.                                                                                 
  10146. #define  TYPEFILE    "FILE"                                                     
  10147. #define  TYPEMENU    "DIRECTORY"                                                
  10148. #define  TYPEINDEX   "INDEX"                                                    
  10149. #define  TYPETELNET  "TELNET"                                                   
  10150. #define  TYPETN3270  "TN3270"                                                   
  10151. #define  TYPEWHOIS   "WHOIS"                                                    
  10152.                                                                                 
  10153. /********************************************************************/          
  10154. /*  used by the REXX Interface                                      */          
  10155. /********************************************************************/          
  10156.                                                                                 
  10157.   /* Be sure to include all 8 bytes, including blanks, in below */              
  10158.                                                                                 
  10159. #define  REXX_EXEC_LIBRARY_DDNAME   "GGEXEC  "                                  
  10160. #define  REXX_EXEC_SUBCOM           "        "                                  
  10161.                                                                                 
  10162. ./ ENDUP                                                                        
  10163. ?!                                                                              
  10164. //PANELS   EXEC GGLOAD,TRK1='4',TO='PANELS'                                     
  10165. //SYSIN    DD DATA,DLM='?!'                                                     
  10166. ./   ADD NAME=GGM,SSI=01060053                                                  
  10167. )ATTR                                                                           
  10168. /*                                                                   /*         
  10169. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10170. /*                                                                   /*         
  10171. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10172. /* including the implied warranties of merchantability and fitness,  /*         
  10173. /* are expressly denied.                                             /*         
  10174. /*                                                                   /*         
  10175. /* Provided this copyright notice is included, this software may     /*         
  10176. /* be freely distributed and not offered for sale.                   /*         
  10177. /*                                                                   /*         
  10178. /* Changes or modifications may be made and used only by the maker   /*         
  10179. /* of same, and not further distributed.  Such modifications should  /*         
  10180. /* be mailed to the author for consideration for addition to the     /*         
  10181. /* software and incorporation in subsequent releases.                /*         
  10182. /*                                                                   /*         
  10183.  ^ TYPE(INPUT) INTENS(HIGH) COLOR(GREEN) CAPS(OFF)                              
  10184.  ! TYPE(TEXT)  INTENS(HIGH) COLOR(RED)                                          
  10185. )BODY EXPAND(``)                                                                
  10186. %-`-`-  MVS Gopher Client -`-`-                                                 
  10187. %COMMAND ===>_ZCMD                                                              
  10188. +                                                                               
  10189. %Gopher server host name+(or IP address) %===>_GGHOST                           
  10190. +                                                                               
  10191. %Initial path%===>^GGPATH                                                       
  10192. %Port number %===>_GGPORT                                                       
  10193. +                                                                               
  10194. +Note:  You may specify a dash%-+as the Gopher server host name if              
  10195.         you want to use your own private Gopher data without making             
  10196.         a connection to a server.  If you do, you must specify the              
  10197.         name of your private Gopher menu in the initial path.                   
  10198.         This name must be UNQUOTED AND FULLY QUALIFIED.                         
  10199.         Alternatively, you may allocate your initial Gopher menu                
  10200.         to file GGGOPHER.                                                       
  10201.                                                                                 
  10202.         Any menu entries must also specify a dash in the host field;            
  10203.         otherwise they will require server access, as usual.                    
  10204.                                                                                 
  10205.         To use the REXX interface, you must allocate file GGEXEC to             
  10206.         your library of Gopherable REXX execs.                                  
  10207.                                                                                 
  10208. +Press!END+key to leave this menu.                                              
  10209. )INIT                                                                           
  10210.  &ZCMD = &Z                                                                     
  10211.  IF (&GGPORT = &Z) &GGPORT = 70                                                 
  10212. )PROC                                                                           
  10213.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  10214.  VER (&GGHOST,NB)                                                               
  10215.  VER (&GGPORT,NUM)                                                              
  10216.  VPUT (GGHOST GGPATH GGPORT) PROFILE                                            
  10217. )END                                                                            
  10218. ./   ADD NAME=GGMDIR,SSI=01020021                                               
  10219. )ATTR                                                                           
  10220. /*                                                                   /*         
  10221. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10222. /*                                                                   /*         
  10223. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10224. /* including the implied warranties of merchantability and fitness,  /*         
  10225. /* are expressly denied.                                             /*         
  10226. /*                                                                   /*         
  10227. /* Provided this copyright notice is included, this software may     /*         
  10228. /* be freely distributed and not offered for sale.                   /*         
  10229. /*                                                                   /*         
  10230. /* Changes or modifications may be made and used only by the maker   /*         
  10231. /* of same, and not further distributed.  Such modifications should  /*         
  10232. /* be mailed to the author for consideration for addition to the     /*         
  10233. /* software and incorporation in subsequent releases.                /*         
  10234. /*                                                                   /*         
  10235.  ~ TYPE(INPUT) INTENS(HIGH)  CAPS(OFF) JUST(LEFT)                               
  10236.  ^ TYPE(INPUT) INTENS(HIGH)  CAPS(OFF) JUST(LEFT)                               
  10237.  ! TYPE(OUTPUT) INTENS(LOW)  CAPS(OFF) JUST(RIGHT) COLOR(YELLOW)                
  10238.  # TYPE(OUTPUT) INTENS(LOW)  CAPS(OFF) JUST(RIGHT) COLOR(BLUE)                  
  10239.  @ TYPE(OUTPUT) INTENS(HIGH) CAPS(OFF) JUST(RIGHT) COLOR(PINK)                  
  10240.  ? TYPE(OUTPUT) INTENS(LOW)  CAPS(OFF) JUST(LEFT)  COLOR(TURQ) PAD('.')         
  10241.  |  AREA(DYNAMIC) EXTEND(ON) SCROLL(ON)                                         
  10242.  \  AREA(DYNAMIC) EXTEND(OFF) SCROLL(OFF)                                       
  10243.  01 TYPE(DATAOUT) INTENS(LOW)                                                   
  10244.  02 TYPE(DATAOUT) INTENS(HIGH)                                                  
  10245.  03 TYPE(DATAIN)  INTENS(LOW)                                                   
  10246.  04 TYPE(DATAIN)  INTENS(HIGH)                                                  
  10247.  05 TYPE(DATAOUT) COLOR(GREEN)                                                  
  10248.  06 TYPE(DATAOUT) COLOR(PINK)                                                   
  10249.  07 TYPE(DATAOUT) COLOR(RED)                                                    
  10250.  08 TYPE(DATAOUT) COLOR(TURQ)                                                   
  10251.  09 TYPE(DATAOUT) COLOR(YELLOW)                                                 
  10252.  0A TYPE(DATAIN)  COLOR(BLUE)                                                   
  10253.  0B TYPE(DATAIN)  COLOR(PINK)                                                   
  10254.  0C TYPE(DATAIN)  COLOR(TURQ)                                                   
  10255.  0D TYPE(DATAIN)  COLOR(WHITE)                                                  
  10256.  0E TYPE(DATAIN)  COLOR(YELLOW)                                                 
  10257. )BODY EXPAND(``)                                                                
  10258. %&GGGHEAD                                                                       
  10259. %COMMAND ===>~GGGCMD                                          %SCROLL ===>^GAMT+
  10260. +                                                                               
  10261. +%S+Select%Q+Query%E+Extract                                                    
  10262.  -------------------------------------------------------------------------------
  10263. |GGGDYNA                                                                       |
  10264. )INIT                                                                           
  10265.  IF (&GAMT = &Z) &GAMT = CSR                                                    
  10266. )PROC                                                                           
  10267.  &GGGLVL = LVLINE(GGGDYNA)                                                      
  10268.  VPUT (GAMT) PROFILE                                                            
  10269. )END                                                                            
  10270. ./   ADD NAME=GGMLCONN,SSI=01000059                                             
  10271. )ATTR                                                                           
  10272. /*                                                                   /*         
  10273. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10274. /*                                                                   /*         
  10275. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10276. /* including the implied warranties of merchantability and fitness,  /*         
  10277. /* are expressly denied.                                             /*         
  10278. /*                                                                   /*         
  10279. /* Provided this copyright notice is included, this software may     /*         
  10280. /* be freely distributed and not offered for sale.                   /*         
  10281. /*                                                                   /*         
  10282. /* Changes or modifications may be made and used only by the maker   /*         
  10283. /* of same, and not further distributed.  Such modifications should  /*         
  10284. /* be mailed to the author for consideration for addition to the     /*         
  10285. /* software and incorporation in subsequent releases.                /*         
  10286. /*                                                                   /*         
  10287.  ^ TYPE(TEXT) INTENS(HIGH) COLOR(BLUE) HILITE(REVERSE)                          
  10288.  @ TYPE(TEXT) INTENS(HIGH) COLOR(PINK)                                          
  10289.  # TYPE(TEXT) INTENS(LOW)  COLOR(TURQ)                                          
  10290.  \ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)                                        
  10291.  ! TYPE(TEXT) INTENS(HIGH) COLOR(RED)                                           
  10292.  $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)                                         
  10293.  ~ TYPE(TEXT) INTENS(HIGH) COLOR(WHITE)                                         
  10294. )BODY EXPAND(``)                                                                
  10295. %-`-`-  MVS Gopher Server Connection -`-`-                                      
  10296. +                                                                               
  10297. +             Client name: &GGCLIENT    Client IP address:  &GGCLIEIP           
  10298. +                                                                               
  10299. +                                                                               
  10300. +             Connection is in progress for Gopher server at:                   
  10301.               &GGSERVER (&GGSERVIP)                                             
  10302. +                                                                               
  10303. +                                                                               
  10304.                                  % Please wait.                                 
  10305. +                                                                               
  10306. +                                                                               
  10307. )INIT                                                                           
  10308. )PROC                                                                           
  10309. )END                                                                            
  10310. ./   ADD NAME=GGMLDISC,SSI=01000024                                             
  10311. )ATTR                                                                           
  10312. /*                                                                   /*         
  10313. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10314. /*                                                                   /*         
  10315. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10316. /* including the implied warranties of merchantability and fitness,  /*         
  10317. /* are expressly denied.                                             /*         
  10318. /*                                                                   /*         
  10319. /* Provided this copyright notice is included, this software may     /*         
  10320. /* be freely distributed and not offered for sale.                   /*         
  10321. /*                                                                   /*         
  10322. /* Changes or modifications may be made and used only by the maker   /*         
  10323. /* of same, and not further distributed.  Such modifications should  /*         
  10324. /* be mailed to the author for consideration for addition to the     /*         
  10325. /* software and incorporation in subsequent releases.                /*         
  10326. /*                                                                   /*         
  10327.  ^ TYPE(TEXT) INTENS(HIGH) COLOR(BLUE) HILITE(REVERSE)                          
  10328.  @ TYPE(TEXT) INTENS(HIGH) COLOR(PINK)                                          
  10329.  # TYPE(TEXT) INTENS(LOW)  COLOR(TURQ)                                          
  10330.  \ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)                                        
  10331.  ! TYPE(TEXT) INTENS(HIGH) COLOR(RED)                                           
  10332.  $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)                                         
  10333.  ~ TYPE(TEXT) INTENS(HIGH) COLOR(WHITE)                                         
  10334. )BODY EXPAND(``)                                                                
  10335. %-`-`-  MVS Gopher Server Connection -`-`-                                      
  10336. +                                                                               
  10337. +                                                                               
  10338. +         Disconnection is in progress from the Gopher server at:               
  10339.           &GGSOLDER (&GGSOLDIP)                                                 
  10340. +                                                                               
  10341. +                                                                               
  10342.                                  % Please wait.                                 
  10343. +                                                                               
  10344. +                                                                               
  10345. )INIT                                                                           
  10346. )PROC                                                                           
  10347. )END                                                                            
  10348. ./   ADD NAME=GGMLEXN2,SSI=01000018                                             
  10349. )ATTR                                                                           
  10350. /*                                                                   /*         
  10351. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10352. /*                                                                   /*         
  10353. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10354. /* including the implied warranties of merchantability and fitness,  /*         
  10355. /* are expressly denied.                                             /*         
  10356. /*                                                                   /*         
  10357. /* Provided this copyright notice is included, this software may     /*         
  10358. /* be freely distributed and not offered for sale.                   /*         
  10359. /*                                                                   /*         
  10360. /* Changes or modifications may be made and used only by the maker   /*         
  10361. /* of same, and not further distributed.  Such modifications should  /*         
  10362. /* be mailed to the author for consideration for addition to the     /*         
  10363. /* software and incorporation in subsequent releases.                /*         
  10364. /*                                                                   /*         
  10365.  ^ TYPE(TEXT) INTENS(HIGH) COLOR(BLUE) HILITE(REVERSE)                          
  10366.  @ TYPE(TEXT) INTENS(HIGH) COLOR(PINK)                                          
  10367.  \ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)                                        
  10368.  ! TYPE(TEXT) INTENS(HIGH) COLOR(RED)                                           
  10369.  $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)                                         
  10370.  ~ TYPE(TEXT) INTENS(HIGH) COLOR(WHITE)                                         
  10371. )BODY EXPAND(``)                                                                
  10372. %-`-`-  MVS Gopher Server Connection -`-`-                                      
  10373. +                                                                               
  10374. +Description: &GGTSUBJ                                                          
  10375. +                                                                               
  10376. +Extracting to: &GGEXDSN                                                        
  10377. +&MEMSTUFF                                                                      
  10378. +                                                                               
  10379.                                  % Please wait.                                 
  10380. +                                                                               
  10381. )INIT                                                                           
  10382.  IF (&GGEXMEM = &Z) &MEMSTUFF = &Z                                              
  10383.  ELSE               &MEMSTUFF = 'Member: &GGEXMEM'                              
  10384. )PROC                                                                           
  10385. )END                                                                            
  10386. ./   ADD NAME=GGMLRCON,SSI=01000048                                             
  10387. )ATTR                                                                           
  10388. /*                                                                   /*         
  10389. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10390. /*                                                                   /*         
  10391. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10392. /* including the implied warranties of merchantability and fitness,  /*         
  10393. /* are expressly denied.                                             /*         
  10394. /*                                                                   /*         
  10395. /* Provided this copyright notice is included, this software may     /*         
  10396. /* be freely distributed and not offered for sale.                   /*         
  10397. /*                                                                   /*         
  10398. /* Changes or modifications may be made and used only by the maker   /*         
  10399. /* of same, and not further distributed.  Such modifications should  /*         
  10400. /* be mailed to the author for consideration for addition to the     /*         
  10401. /* software and incorporation in subsequent releases.                /*         
  10402. /*                                                                   /*         
  10403.  ^ TYPE(TEXT) INTENS(HIGH) COLOR(BLUE) HILITE(REVERSE)                          
  10404.  @ TYPE(TEXT) INTENS(HIGH) COLOR(PINK)                                          
  10405.  # TYPE(TEXT) INTENS(LOW)  COLOR(TURQ)                                          
  10406.  \ TYPE(TEXT) INTENS(HIGH) COLOR(YELLOW)                                        
  10407.  ! TYPE(TEXT) INTENS(HIGH) COLOR(RED)                                           
  10408.  $ TYPE(TEXT) INTENS(LOW)  COLOR(GREEN)                                         
  10409.  ~ TYPE(TEXT) INTENS(HIGH) COLOR(WHITE)                                         
  10410. )BODY EXPAND(``)                                                                
  10411. %-`-`-  MVS Gopher Server Connection -`-`-                                      
  10412. +                                                                               
  10413.         +Connection has apparently been lost to the Gopher server at:           
  10414.         &GGSERVER (&GGSERVIP)                                                   
  10415. +                                                                               
  10416.                 +Reconnection to the server is in progress.                     
  10417. +                                                                               
  10418.                                  % Please wait.                                 
  10419. +                                                                               
  10420. +                                                                               
  10421. )INIT                                                                           
  10422. )PROC                                                                           
  10423. )END                                                                            
  10424. ./   ADD NAME=GGMPCSO,SSI=01000011                                              
  10425. )ATTR                                                                           
  10426. /*                                                                   /*         
  10427. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10428. /*                                                                   /*         
  10429. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10430. /* including the implied warranties of merchantability and fitness,  /*         
  10431. /* are expressly denied.                                             /*         
  10432. /*                                                                   /*         
  10433. /* Provided this copyright notice is included, this software may     /*         
  10434. /* be freely distributed and not offered for sale.                   /*         
  10435. /*                                                                   /*         
  10436. /* Changes or modifications may be made and used only by the maker   /*         
  10437. /* of same, and not further distributed.  Such modifications should  /*         
  10438. /* be mailed to the author for consideration for addition to the     /*         
  10439. /* software and incorporation in subsequent releases.                /*         
  10440. /*                                                                   /*         
  10441.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10442. )BODY WINDOW(58,10)                                                             
  10443. +                                                                               
  10444. %Command ===>^ZCMD                                                              
  10445. +                                                                               
  10446. +Enter name to search for:                                                      
  10447. +                                                                               
  10448. %===>^GGCSOQ                                                                    
  10449.                                                                                 
  10450. +Press%ENTER+to submit search request.                                          
  10451. +Press%&END (END)+to cancel the request.                                        
  10452. +                                                                               
  10453. )INIT                                                                           
  10454.  &ZWINTTL = 'CSO Nameserver User Name Search'                                   
  10455.  &END = PFK(END)                                                                
  10456.  .CURSOR = GGCSOQ                                                               
  10457. )PROC                                                                           
  10458.  IF  (&ZCMD ^= &Z) .MSG = ISPZ001                                               
  10459.  VER (&GGCSOQ,NB)                                                               
  10460.  VPUT (GGCSOQ) PROFILE                                                          
  10461. )END                                                                            
  10462. ./   ADD NAME=GGMPEXDS,SSI=01000044                                             
  10463. )ATTR                                                                           
  10464. /*                                                                   /*         
  10465. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10466. /*                                                                   /*         
  10467. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10468. /* including the implied warranties of merchantability and fitness,  /*         
  10469. /* are expressly denied.                                             /*         
  10470. /*                                                                   /*         
  10471. /* Provided this copyright notice is included, this software may     /*         
  10472. /* be freely distributed and not offered for sale.                   /*         
  10473. /*                                                                   /*         
  10474. /* Changes or modifications may be made and used only by the maker   /*         
  10475. /* of same, and not further distributed.  Such modifications should  /*         
  10476. /* be mailed to the author for consideration for addition to the     /*         
  10477. /* software and incorporation in subsequent releases.                /*         
  10478. /*                                                                   /*         
  10479.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10480. )BODY WINDOW(77,16)                                                             
  10481. +                                                                               
  10482. %Command ===>^ZCMD                                                              
  10483. +                                                                               
  10484. %&SUBJECT                                                                       
  10485. +                                                                               
  10486. +Save to data set ===>_GGEXDSN                                                  
  10487. +Expand tab characters?       ===>_Z  +                                         
  10488.                                                                                 
  10489. +(Note: Data set will be RECFM=VB, LRECL=259, BLKSIZE=6233.)                    
  10490.                                                                                 
  10491. +Append to end of data set?   ===>_Z  +                                         
  10492. +Blank line after separator?  ===>_Z  +                                         
  10493. +Separator line between items (append mode only...blank for none):              
  10494. +>^Z                                                                       +<   
  10495.                                                                                 
  10496. +Press%&END (END)+to cancel the extract request.                                
  10497. )INIT                                                                           
  10498.  .ZVARS = '(GGEXTAB GGEXAPP GGEXBLK GGEXSEP)'                                   
  10499.  .CURSOR = GGEXDSN                                                              
  10500.  &ZWINTTL = 'Extract text'                                                      
  10501.  &SUBJECT = '&GGTSUBJ'                                                          
  10502.  &END = PFK(END)                                                                
  10503.  &ZCMD = &Z                                                                     
  10504.  VGET (GGEXDSN GGEXTAB GGEXAPP GGEXBLK GGEXSEP) PROFILE                         
  10505.  &GGEXTAB = TRANS(&GGEXTAB Y,YES N,NO ' ',NO)                                   
  10506.  &GGEXAPP = TRANS(&GGEXAPP Y,YES N,NO ' ',NO)                                   
  10507.  &GGEXBLK = TRANS(&GGEXBLK Y,YES N,NO ' ',NO)                                   
  10508. )PROC                                                                           
  10509.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  10510.  VER(&GGEXDSN,NB,DSNAME)                                                        
  10511.  &GGEXTAB = TRUNC(&GGEXTAB,1)                                                   
  10512.  VER(&GGEXTAB,NB,LIST,Y,N)                                                      
  10513.  &GGEXAPP = TRUNC(&GGEXAPP,1)                                                   
  10514.  VER(&GGEXAPP,NB,LIST,Y,N)                                                      
  10515.  &GGEXBLK = TRUNC(&GGEXBLK,1)                                                   
  10516.  VER(&GGEXBLK,NB,LIST,Y,N)                                                      
  10517.  VPUT (GGEXDSN GGEXTAB GGEXAPP GGEXBLK GGEXSEP) PROFILE                         
  10518. )END                                                                            
  10519. ./   ADD NAME=GGMPEXNG,SSI=01000027                                             
  10520. )ATTR                                                                           
  10521. /*                                                                   /*         
  10522. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10523. /*                                                                   /*         
  10524. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10525. /* including the implied warranties of merchantability and fitness,  /*         
  10526. /* are expressly denied.                                             /*         
  10527. /*                                                                   /*         
  10528. /* Provided this copyright notice is included, this software may     /*         
  10529. /* be freely distributed and not offered for sale.                   /*         
  10530. /*                                                                   /*         
  10531. /* Changes or modifications may be made and used only by the maker   /*         
  10532. /* of same, and not further distributed.  Such modifications should  /*         
  10533. /* be mailed to the author for consideration for addition to the     /*         
  10534. /* software and incorporation in subsequent releases.                /*         
  10535. /*                                                                   /*         
  10536.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10537. )BODY WINDOW(77,14)                                                             
  10538. +                                                                               
  10539. %Command ===>^ZCMD                                                              
  10540. +                                                                               
  10541. +Save to data set ===>_GGEXDSN                                                  
  10542.                                                                                 
  10543. +(Note: Data set will be RECFM=VB, LRECL=259, BLKSIZE=6233.)                    
  10544.                                                                                 
  10545. +Append to end of data set?   ===>_Z  +                                         
  10546. +Blank line after separator?  ===>_Z  +                                         
  10547. +Separator line between items (append mode only...blank for none):              
  10548. +>^Z                                                                       +<   
  10549.                                                                                 
  10550. +Press%&END (END)+to cancel the extract request.                                
  10551. )INIT                                                                           
  10552.  .ZVARS = '(GGEXAPP GGEXBLK GGEXSEP)'                                           
  10553.  .CURSOR = GGEXDSN                                                              
  10554.  &ZWINTTL = 'Extract item listing'                                              
  10555.  &END = PFK(END)                                                                
  10556.  &ZCMD = &Z                                                                     
  10557.  VGET (GGEXDSN GGEXAPP GGEXBLK GGEXSEP) PROFILE                                 
  10558.  &GGEXAPP = TRANS(&GGEXAPP Y,YES N,NO ' ',NO)                                   
  10559.  &GGEXBLK = TRANS(&GGEXBLK Y,YES N,NO ' ',NO)                                   
  10560. )PROC                                                                           
  10561.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  10562.  VER(&GGEXDSN,NB,DSNAME)                                                        
  10563.  &GGEXAPP = TRUNC(&GGEXAPP,1)                                                   
  10564.  VER(&GGEXAPP,NB,LIST,Y,N)                                                      
  10565.  &GGEXBLK = TRUNC(&GGEXBLK,1)                                                   
  10566.  VER(&GGEXBLK,NB,LIST,Y,N)                                                      
  10567.  VPUT (GGEXDSN GGEXAPP GGEXBLK GGEXSEP) PROFILE                                 
  10568. )END                                                                            
  10569. ./   ADD NAME=GGMPEXNP,SSI=01000026                                             
  10570. )ATTR                                                                           
  10571. /*                                                                   /*         
  10572. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10573. /*                                                                   /*         
  10574. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10575. /* including the implied warranties of merchantability and fitness,  /*         
  10576. /* are expressly denied.                                             /*         
  10577. /*                                                                   /*         
  10578. /* Provided this copyright notice is included, this software may     /*         
  10579. /* be freely distributed and not offered for sale.                   /*         
  10580. /*                                                                   /*         
  10581. /* Changes or modifications may be made and used only by the maker   /*         
  10582. /* of same, and not further distributed.  Such modifications should  /*         
  10583. /* be mailed to the author for consideration for addition to the     /*         
  10584. /* software and incorporation in subsequent releases.                /*         
  10585. /*                                                                   /*         
  10586.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10587. )BODY EXPAND(``) WINDOW(77,14)                                                  
  10588. +                                                                               
  10589. %Command ===>^ZCMD                                                              
  10590. +                                                                               
  10591. +Data set name%===>_GGEXPDS                                                     
  10592. +Member prefix%===>_GGEXPMP + (item number appended - default is%#+)            
  10593.                                                                                 
  10594. +Note: The dataset must be a PDS (old or new) with RECFM=VB and LRECL=259.      
  10595.                                                                                 
  10596. +Expand tab characters?      %===>_Z  +                                         
  10597.                                                                                 
  10598. +From item number%===>_GGEXAN1         + (blank for first item in table)        
  10599. +To   item number%===>_GGEXAN2         + (blank for last item in table)         
  10600.                                                                                 
  10601. +Press%&END (END)+to cancel the extract request.                                
  10602. )INIT                                                                           
  10603.  .ZVARS = '(GGEXTAB)'                                                           
  10604.  .CURSOR = ZCMD                                                                 
  10605.  &ZWINTTL = 'Log text of items to PDS members'                                  
  10606.  &END = PFK(END)                                                                
  10607.  &ZCMD = &Z                                                                     
  10608.  VGET (GGEXPDS GGEXPMP GGEXTAB) PROFILE                                         
  10609.  &GGEXTAB = TRANS(&GGEXTAB Y,YES N,NO ' ',NO)                                   
  10610.  IF (&GGEXPMP = &Z) &GGEXPMP = '#'                                              
  10611.  &GGEXAN1 = &Z                                                                  
  10612.  &GGEXAN2 = &Z                                                                  
  10613. )PROC                                                                           
  10614.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  10615.  &GGEXTAB = TRUNC(&GGEXTAB,1)                                                   
  10616.  VER(&GGEXTAB,NB,LIST,Y,N)                                                      
  10617.  VER(&GGEXPDS,NB,DSNAME)                                                        
  10618.  &TEMP1 = TRUNC(&GGEXPDS,1)                                                     
  10619.  &TEMP2 = .TRAIL                                                                
  10620.  IF (&TEMP1 = '''')                                                             
  10621.   &GGEXDSN = TRUNC(&TEMP2,'''')                                                 
  10622.  ELSE                                                                           
  10623.   &GGEXDSN = '&ZPREFIX..&GGEXPDS'                                               
  10624.   VER(&GGEXPMP,NB,NAME)                                                         
  10625.  VER(&GGEXAN1,NUM)                                                              
  10626.  VER(&GGEXAN2,NUM)                                                              
  10627.  VPUT (GGEXPDS GGEXPMP GGEXTAB) PROFILE                                         
  10628. )END                                                                            
  10629. ./   ADD NAME=GGMPEXNS,SSI=01000057                                             
  10630. )ATTR                                                                           
  10631. /*                                                                   /*         
  10632. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10633. /*                                                                   /*         
  10634. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10635. /* including the implied warranties of merchantability and fitness,  /*         
  10636. /* are expressly denied.                                             /*         
  10637. /*                                                                   /*         
  10638. /* Provided this copyright notice is included, this software may     /*         
  10639. /* be freely distributed and not offered for sale.                   /*         
  10640. /*                                                                   /*         
  10641. /* Changes or modifications may be made and used only by the maker   /*         
  10642. /* of same, and not further distributed.  Such modifications should  /*         
  10643. /* be mailed to the author for consideration for addition to the     /*         
  10644. /* software and incorporation in subsequent releases.                /*         
  10645. /*                                                                   /*         
  10646.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10647. )BODY EXPAND(``) WINDOW(77,17)                                                  
  10648. +                                                                               
  10649. %Command ===>^ZCMD                                                              
  10650. +                                                                               
  10651. +Data set name%===>_GGEXSEQ                                                     
  10652. +(Note: Data set will be RECFM=VB, LRECL=259, BLKSIZE=6233.)                    
  10653. +                                                                               
  10654. +Expand tab characters?      %===>_Z  +                                         
  10655. +                                                                               
  10656. +Append to end of data set?  %===>_Z  +                                         
  10657. +Blank line after separator? %===>_Z  +                                         
  10658. +Separator line before each item (leave blank for none):                        
  10659. +>^Z                                                                       +<   
  10660.                                                                                 
  10661. +From item number%===>_GGEXAN1         + (blank for first item in table)        
  10662. +To   item number%===>_GGEXAN2         + (blank for last item in table)         
  10663.                                                                                 
  10664. +Press%&END (END)+to cancel the extract request.                                
  10665. )INIT                                                                           
  10666.  .ZVARS = '(GGEXTAB GGEXAPP GGEXBLK GGEXSEP)'                                   
  10667.  .CURSOR = ZCMD                                                                 
  10668.  &ZWINTTL = 'Log text of items to sequential file'                              
  10669.  &END = PFK(END)                                                                
  10670.  &ZCMD = &Z                                                                     
  10671.  VGET (GGEXSEQ GGEXTAB GGEXAPP GGEXBLK GGEXSEP) PROFILE                         
  10672.  &GGEXTAB = TRANS(&GGEXTAB Y,YES N,NO ' ',NO)                                   
  10673.  &GGEXAPP = TRANS(&GGEXAPP Y,YES N,NO ' ',NO)                                   
  10674.  &GGEXBLK = TRANS(&GGEXBLK Y,YES N,NO ' ',NO)                                   
  10675.  &GGEXAN1 = &Z                                                                  
  10676.  &GGEXAN2 = &Z                                                                  
  10677. )PROC                                                                           
  10678.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  10679.  VER(&GGEXSEQ,NB,DSNAME)                                                        
  10680.  &GGEXDSN = &GGEXSEQ                                                            
  10681.  &GGEXTAB = TRUNC(&GGEXTAB,1)                                                   
  10682.  VER(&GGEXTAB,NB,LIST,Y,N)                                                      
  10683.  &GGEXAPP = TRUNC(&GGEXAPP,1)                                                   
  10684.  VER(&GGEXAPP,NB,LIST,Y,N)                                                      
  10685.  &GGEXBLK = TRUNC(&GGEXBLK,1)                                                   
  10686.  VER(&GGEXBLK,NB,LIST,Y,N)                                                      
  10687.  VER(&GGEXAN1,NUM)                                                              
  10688.  VER(&GGEXAN2,NUM)                                                              
  10689.  VPUT (GGEXSEQ GGEXTAB GGEXAPP GGEXBLK GGEXSEP) PROFILE                         
  10690. )END                                                                            
  10691. ./   ADD NAME=GGMPEXNT,SSI=01000035                                             
  10692. )ATTR                                                                           
  10693. /*                                                                   /*         
  10694. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10695. /*                                                                   /*         
  10696. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10697. /* including the implied warranties of merchantability and fitness,  /*         
  10698. /* are expressly denied.                                             /*         
  10699. /*                                                                   /*         
  10700. /* Provided this copyright notice is included, this software may     /*         
  10701. /* be freely distributed and not offered for sale.                   /*         
  10702. /*                                                                   /*         
  10703. /* Changes or modifications may be made and used only by the maker   /*         
  10704. /* of same, and not further distributed.  Such modifications should  /*         
  10705. /* be mailed to the author for consideration for addition to the     /*         
  10706. /* software and incorporation in subsequent releases.                /*         
  10707. /*                                                                   /*         
  10708.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10709. )BODY WINDOW(77,10)                                                             
  10710. +                                                                               
  10711. %Command ===>^ZCMD                                                              
  10712. +                                                                               
  10713. +Move cursor to choice (or type%S+next to choice) and press%ENTER+to select:    
  10714. +                                                                               
  10715. _A%1+- List%titles+of items in table                                            
  10716. _B%2+- Log %text  +of items to%sequential file+                                 
  10717. _C%3+- Log %text  +of items to%members of PDS+                                  
  10718. +                                                                               
  10719. +Press%&END (END)+to cancel the extract request.                                
  10720. )INIT                                                                           
  10721.  .CURSOR = ZCMD                                                                 
  10722.  &ZWINTTL = 'Extract Gopher items - titles or text'                             
  10723.  &END = PFK(END)                                                                
  10724.  &ZCMD = &Z                                                                     
  10725.  &A = &Z                                                                        
  10726.  &B = &Z                                                                        
  10727.  &C = &Z                                                                        
  10728. )PROC                                                                           
  10729.  VER(&ZCMD,LIST,1,2,3)                                                          
  10730.  IF (&ZCMD ^= &Z)                                                               
  10731.   &GGCHOICE = TRANS(&ZCMD 1 1 2 2 3 3 * ?)                                      
  10732.  ELSE                                                                           
  10733.   &TEMP = '&A/&B/&C'                                                            
  10734.   IF (&TEMP = '//')                                                             
  10735.    &GGCHOICE = TRANS(.CURSOR A 1 B 2 C 3 * ?)                                   
  10736.   ELSE                                                                          
  10737.    &GGCHOICE = TRANS(&TEMP  'S//' 1                                             
  10738.                             '1//' 1                                             
  10739.                             '/S/' 2                                             
  10740.                             '/2/' 2                                             
  10741.                             '//S' 3                                             
  10742.                             '//3' 3                                             
  10743.                                * ?                                              
  10744.                    )                                                            
  10745. )END                                                                            
  10746. ./   ADD NAME=GGMPEXN1,SSI=01000007                                             
  10747. )ATTR                                                                           
  10748. /*                                                                   /*         
  10749. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10750. /*                                                                   /*         
  10751. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10752. /* including the implied warranties of merchantability and fitness,  /*         
  10753. /* are expressly denied.                                             /*         
  10754. /*                                                                   /*         
  10755. /* Provided this copyright notice is included, this software may     /*         
  10756. /* be freely distributed and not offered for sale.                   /*         
  10757. /*                                                                   /*         
  10758. /* Changes or modifications may be made and used only by the maker   /*         
  10759. /* of same, and not further distributed.  Such modifications should  /*         
  10760. /* be mailed to the author for consideration for addition to the     /*         
  10761. /* software and incorporation in subsequent releases.                /*         
  10762. /*                                                                   /*         
  10763.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10764. )BODY WINDOW(77,14)                                                             
  10765. +                                                                               
  10766. %Command ===>^ZCMD                                                              
  10767. +                                                                               
  10768. +Save to data set ===>_GGEXDSN                                                  
  10769.                                                                                 
  10770. +(Note: Data set will be RECFM=VB, LRECL=259, BLKSIZE=6233.)                    
  10771.                                                                                 
  10772. +Append to end of data set?   ===>_Z  +                                         
  10773. +Blank line after separator?  ===>_Z  +                                         
  10774. +Separator line between items (append mode only...blank for none):              
  10775. +>^Z                                                                       +<   
  10776.                                                                                 
  10777. +Press%&END (END)+to cancel the extract request.                                
  10778. )INIT                                                                           
  10779.  .ZVARS = '(GGEXAPP GGEXBLK GGEXSEP)'                                           
  10780.  .CURSOR = GGEXDSN                                                              
  10781.  &ZWINTTL = 'Extract Gopher item listing'                                       
  10782.  &END = PFK(END)                                                                
  10783.  &ZCMD = &Z                                                                     
  10784.  VGET (GGEXDSN GGEXAPP GGEXBLK GGEXSEP) PROFILE                                 
  10785.  &GGEXAPP = TRANS(&GGEXAPP Y,YES N,NO ' ',NO)                                   
  10786.  &GGEXBLK = TRANS(&GGEXBLK Y,YES N,NO ' ',NO)                                   
  10787. )PROC                                                                           
  10788.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  10789.  VER(&GGEXDSN,NB,DSNAME)                                                        
  10790.  &GGEXAPP = TRUNC(&GGEXAPP,1)                                                   
  10791.  VER(&GGEXAPP,NB,LIST,Y,N)                                                      
  10792.  &GGEXBLK = TRUNC(&GGEXBLK,1)                                                   
  10793.  VER(&GGEXBLK,NB,LIST,Y,N)                                                      
  10794.  VPUT (GGEXDSN GGEXAPP GGEXBLK GGEXSEP) PROFILE                                 
  10795. )END                                                                            
  10796. ./   ADD NAME=GGMPEXOW,SSI=01000030                                             
  10797. )ATTR                                                                           
  10798. /*                                                                   /*         
  10799. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10800. /*                                                                   /*         
  10801. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10802. /* including the implied warranties of merchantability and fitness,  /*         
  10803. /* are expressly denied.                                             /*         
  10804. /*                                                                   /*         
  10805. /* Provided this copyright notice is included, this software may     /*         
  10806. /* be freely distributed and not offered for sale.                   /*         
  10807. /*                                                                   /*         
  10808. /* Changes or modifications may be made and used only by the maker   /*         
  10809. /* of same, and not further distributed.  Such modifications should  /*         
  10810. /* be mailed to the author for consideration for addition to the     /*         
  10811. /* software and incorporation in subsequent releases.                /*         
  10812. /*                                                                   /*         
  10813.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10814. )BODY WINDOW(58,10)                                                             
  10815. +                                                                               
  10816. %Command ===>^ZCMD                                                              
  10817. +                                                                               
  10818. +Dataset already exists:                                                        
  10819. +                                                                               
  10820. %&GGEXDSN                                                                       
  10821. +                                                                               
  10822. +Press%ENTER+to%&ACTION                                                         
  10823. +Press%&END (END)+to cancel the request.                                        
  10824. +                                                                               
  10825. )INIT                                                                           
  10826.  .ALARM = YES                                                                   
  10827.  &ZWINTTL = 'Extract To Existing Data Set'                                      
  10828.  &END = PFK(END)                                                                
  10829.  &APP = TRUNC(&GGEXAPP,1)                                                       
  10830.  IF (&APP = Y) &ACTION = 'append to the end of the data set.'                   
  10831.  ELSE          &ACTION = 'overwrite the current data set.'                      
  10832. )PROC                                                                           
  10833.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  10834. )END                                                                            
  10835. ./   ADD NAME=GGMPEXPW,SSI=01000053                                             
  10836. )ATTR                                                                           
  10837. /*                                                                   /*         
  10838. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10839. /*                                                                   /*         
  10840. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10841. /* including the implied warranties of merchantability and fitness,  /*         
  10842. /* are expressly denied.                                             /*         
  10843. /*                                                                   /*         
  10844. /* Provided this copyright notice is included, this software may     /*         
  10845. /* be freely distributed and not offered for sale.                   /*         
  10846. /*                                                                   /*         
  10847. /* Changes or modifications may be made and used only by the maker   /*         
  10848. /* of same, and not further distributed.  Such modifications should  /*         
  10849. /* be mailed to the author for consideration for addition to the     /*         
  10850. /* software and incorporation in subsequent releases.                /*         
  10851. /*                                                                   /*         
  10852.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10853. )BODY WINDOW(58,13)                                                             
  10854. +                                                                               
  10855. %Command ===>^ZCMD                                                              
  10856. +                                                                               
  10857. +Paritioned dataset already exists:                                             
  10858. +                                                                               
  10859. %&GGEXDSN                                                                       
  10860. +                                                                               
  10861. +If member names are generated that match existing members                      
  10862. +of this PDS, they will be%overwritten.+                                        
  10863. +                                                                               
  10864. +Press%ENTER+to proceed to use this PDS.                                        
  10865. +Press%&END (END)+to cancel the request.                                        
  10866. +                                                                               
  10867. )INIT                                                                           
  10868.  .ALARM = YES                                                                   
  10869.  &ZWINTTL = 'Extract To Members of Existing PDS'                                
  10870.  &END = PFK(END)                                                                
  10871. )PROC                                                                           
  10872.  IF (&ZCMD ^= &Z) .MSG = ISPZ001                                                
  10873. )END                                                                            
  10874. ./   ADD NAME=GGMPWAIS,SSI=01020012                                             
  10875. )ATTR                                                                           
  10876. /*                                                                   /*         
  10877. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10878. /*                                                                   /*         
  10879. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10880. /* including the implied warranties of merchantability and fitness,  /*         
  10881. /* are expressly denied.                                             /*         
  10882. /*                                                                   /*         
  10883. /* Provided this copyright notice is included, this software may     /*         
  10884. /* be freely distributed and not offered for sale.                   /*         
  10885. /*                                                                   /*         
  10886. /* Changes or modifications may be made and used only by the maker   /*         
  10887. /* of same, and not further distributed.  Such modifications should  /*         
  10888. /* be mailed to the author for consideration for addition to the     /*         
  10889. /* software and incorporation in subsequent releases.                /*         
  10890. /*                                                                   /*         
  10891.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10892. )BODY WINDOW(58,10)                                                             
  10893. +                                                                               
  10894. %Command ===>^ZCMD                                                              
  10895. +                                                                               
  10896. +Enter index search query:                                                      
  10897. +                                                                               
  10898. %===>^GGWAISQ                                                                   
  10899.                                                                                 
  10900. +Press%ENTER+to submit search request.                                          
  10901. +Press%&END (END)+to cancel the request.                                        
  10902. +                                                                               
  10903. )INIT                                                                           
  10904.  &ZWINTTL = 'GOPHER Full Text Index Search'                                     
  10905.  &END = PFK(END)                                                                
  10906.  .CURSOR = GGWAISQ                                                              
  10907. )PROC                                                                           
  10908.  IF  (&ZCMD ^= &Z) .MSG = ISPZ001                                               
  10909.  VER (&GGWAISQ,NB)                                                              
  10910.  VPUT (GGWAISQ) PROFILE                                                         
  10911. )END                                                                            
  10912. ./   ADD NAME=GGMPWHOI,SSI=01000019                                             
  10913. )ATTR                                                                           
  10914. /*                                                                   /*         
  10915. /* Copyright (c) The Charles Stark Draper Laboratory, Inc., 1992     /*         
  10916. /*                                                                   /*         
  10917. /* This software is provided on an "AS IS" basis.  All warranties,   /*         
  10918. /* including the implied warranties of merchantability and fitness,  /*         
  10919. /* are expressly denied.                                             /*         
  10920. /*                                                                   /*         
  10921. /* Provided this copyright notice is included, this software may     /*         
  10922. /* be freely distributed and not offered for sale.                   /*         
  10923. /*                                                                   /*         
  10924. /* Changes or modifications may be made and used only by the maker   /*         
  10925. /* of same, and not further distributed.  Such modifications should  /*         
  10926. /* be mailed to the author for consideration for addition to the     /*         
  10927. /* software and incorporation in subsequent releases.                /*         
  10928. /*                                                                   /*         
  10929.        ^   TYPE(INPUT) INTENS(HIGH) CAPS(OFF) JUST(LEFT)                        
  10930. )BODY WINDOW(58,10)                                                             
  10931. +                                                                               
  10932. %Command ===>^ZCMD                                                              
  10933. +                                                                               
  10934. +Enter name to search for:                                                      
  10935. +                                                                               
  10936. %===>^GGWHOISQ                                                                  
  10937.                                                                                 
  10938. +Press%ENTER+to submit search request.                                          
  10939. +Press%&END (END)+to cancel the request.                                        
  10940. +                                                                               
  10941. )INIT                                                                           
  10942.  &ZWINTTL = 'WHOIS/FINGER User Name Search'                                     
  10943.  &END = PFK(END)                                                                
  10944.  .CURSOR = GGWHOISQ                                                             
  10945. )PROC                                                                           
  10946.  IF  (&ZCMD ^= &Z) .MSG = ISPZ001                                               
  10947.  VER (&GGWHOISQ,NB)                                                             
  10948.  VPUT (GGWHOISQ) PROFILE                                                        
  10949. )END                                                                            
  10950. ./ ENDUP                                                                        
  10951. ?!                                                                              
  10952.